library(dplyr)
library(lavaan)
library(DiagrammeR)
library(ggplot2)
library(tidyr)
# For saving SEM diagrams:
library(purrr)
library(DiagrammeRsvg)
library(rsvg)
library(png)
library(grid)
library(ggpubr)
combined=read.csv("data/monthly_averages/monthly_data_compiled_regions.csv",stringsAsFactors = F)
cnames=read.csv("analysis/column_names_region_monthly.csv", stringsAsFactors = F)
dsub=filter(combined, Year>=1995) %>% arrange(Region,Year,Month)
focaldata=dsub[,cnames$Datacolumn]
fvars=cnames$Shortname
colnames(focaldata)=fvars
regions=unique(focaldata$region)
regionorder=c("Far West","West","North","South")
focaldata=focaldata%>%
mutate(decyear=year+(month-1)/12)
focaldata = focaldata %>%
mutate(tzoop=hcope+clad+mysid+pcope+rotif_m,
tzoop_e=hcope_e+clad_e+mysid_e+pcope_e+rotif_e,
hzoop=hcope+clad+rotif_m,
hzoop_e=hcope_e+clad_e+rotif_e,
pzoop=mysid+pcope,
pzoop_e=mysid_e+pcope_e,
turbid=-secchi)
fvars=c(fvars,"tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e","turbid")
cnames=rbind(cnames,data.frame(Longname=NA,Shortname=c("tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e","turbid"),
Diagramname=c("total zooplankton",
"total zooplankton\nenergy",
"herbivorous\nzooplankton",
"herbivorous\nzooplankton\nenergy",
"predatory\nzooplankton",
"predatory\nzooplankton\nenergy",
"turbidity"),
Datacolumn=NA,Log=c(rep("yes",6),"no"),
Color=c("black","black","#ED7D31","#ED7D31","#7030A0",
"#7030A0","#4472C4")))
#focal variables
varnames=c("temp","flow","turbid","dophos","din","chla","hcope","clad","amphi_m","pcope","mysid","rotif_m","potam","corbic","sside","cent","sbass1_bsmt","marfish_bsmt","estfish_bsmt","tzoop","hzoop","pzoop")
#labels for lagged vars
cnameslag=cnames
cnameslag$Shortname=paste0(cnameslag$Shortname,"_1")
cnameslag$Diagramname=paste(cnameslag$Diagramname,"(t-1)")
cnameslag=rbind(cnames,cnameslag)
#labeld for growth rate
cnamesgr=cnames
cnamesgr$Shortname=paste0(cnamesgr$Shortname,"_gr")
cnamesgr$Diagramname=paste(cnamesgr$Diagramname,"(gr)")
cnameslag=rbind(cnameslag,cnamesgr)
source("analysis/myLavaanPlot.r")
source("analysis/semDiagramFunctions.r")
Log transform, scale.
Within and across regions.
Create set with regional monthly means removed.
#log transform
logvars=fvars[cnames$Log=="yes"]
logtrans=function(x) {
x2=x[which(!is.na(x))]
if(any(x2==0)) {log(x+min(x2[which(x2>0)],na.rm=T))}
else {log(x)}
}
focaldatalog = focaldata %>%
mutate(flow=flow-min(flow,na.rm=T)) %>% #get rid of negative flow values
mutate_at(logvars,logtrans) %>%
group_by(region) %>%
mutate_at(logvars,list("gr"=function(x) {c(NA,diff(x))})) %>%
ungroup()
#scale data
fdr0=focaldatalog
tvars=fvars[-(1:3)]
#scaled within regions
fdr=fdr0 %>%
group_by(region) %>%
#scale
mutate_at(tvars,scale) %>%
#lag
mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
ungroup() %>%
as.data.frame()
#scaled within regions, remove monthly means
fdr_ds=fdr %>%
group_by(region,month) %>%
mutate_at(tvars,list("mm"=function(x) {mean(x,na.rm = T)})) %>%
mutate_at(tvars,function(x) {x-mean(x,na.rm = T)}) %>%
ungroup() %>%
#lag
group_by(region) %>%
mutate_at(tvars,scale) %>%
mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
ungroup() %>%
as.data.frame()
#scaled across regions
# fdr1=fdr0 %>%
# #scale
# mutate_at(tvars,scale) %>%
# #lag
# group_by(region) %>%
# mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
# ungroup() %>%
# as.data.frame()
#scaled across regions, monthly means removed
# fdr1_ds=fdr1 %>%
# group_by(region,month) %>%
# mutate_at(tvars,list("mm"=function(x) {mean(x,na.rm = T)})) %>%
# mutate_at(tvars,function(x) {x-mean(x,na.rm = T)}) %>%
# ungroup() %>%
# #lag
# group_by(region) %>%
# mutate_at(tvars,list("1"=lag,"2"=function(x) {lag(x,2)})) %>%
# ungroup() %>%
# as.data.frame()
Exclude individual zooplankton plankton groups from zooplankton model if rare (95% of values in a region are less than the across site mean, or more than 10% of values in a region are zeros).
sside and cent have no data in FW and W.
marfish and clams excluded if 95% of values in a region are less than the across site mean, though this results in marfish being excluded from W.
FW: exclude clad, mysid, corbic, sside/cent
W: exclude clad, corbic, marfish, sside/cent
N: exclude clad, potam, marfish
S: exclude mysid, potam, marfish
dataavail=focaldata %>%
gather(var, value, 4:length(fvars)) %>%
group_by(var) %>%
mutate(varmean=mean(value, na.rm=T)) %>% ungroup() %>%
group_by(region, var) %>%
summarize(
propmissing=length(which(is.na(value)))/length(value),
propzeros=length(which(value==0))/length(which(!is.na(value))),
exclude=ifelse(quantile(value,probs = 0.95, na.rm = T)<mean(varmean),T,F)) %>%
as.data.frame()
## `summarise()` has grouped output by 'region'. You can override using the
## `.groups` argument.
#these variables should not be used (too many zeros)
filter(dataavail,propzeros>0.1 | exclude) %>% filter(var %in% c("mysid","hcope","pcope","rotif_m","clad"))
## region var propmissing propzeros exclude
## 1 Far West clad 0.141025641 0.95149254 TRUE
## 2 Far West mysid 0.137820513 0.21933086 TRUE
## 3 North clad 0.012820513 0.14610390 FALSE
## 4 South mysid 0.006410256 0.08709677 TRUE
## 5 West clad 0.009615385 0.26537217 FALSE
filter(dataavail,exclude) %>% filter(var %in% c("marfish_bsmt","potam","corbic"))
## region var propmissing propzeros exclude
## 1 Far West corbic 0.1410256 1.0000000 TRUE
## 2 North marfish_bsmt 0.1891026 0.9762846 TRUE
## 3 North potam 0.1378205 0.1486989 TRUE
## 4 South marfish_bsmt 0.1826923 1.0000000 TRUE
## 5 South potam 0.1378205 0.9702602 TRUE
## 6 West corbic 0.1378205 0.8066914 TRUE
## 7 West marfish_bsmt 0.1666667 0.2192308 TRUE
## Note: Using an external vector in selections is ambiguous.
## i Use `all_of(varnames)` instead of `varnames` to silence this message.
## i See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This message is displayed once per session.
Breakdown of total zooplankton biomass.
## Warning: Removed 272 rows containing missing values (position_stack).
Correlation between biomass and energy.
for(i in 1:length(regions)) {
dtemp=filter(fdr,region==regions[i])
print(regions[i])
print(cor(dtemp$tzoop,dtemp$tzoop_e,use = "p"))
print(cor(dtemp$hzoop,dtemp$hzoop_e,use = "p"))
print(cor(dtemp$pzoop,dtemp$pzoop_e,use = "p"))
}
## [1] "Far West"
## [,1]
## [1,] 0.9967037
## [,1]
## [1,] 0.9969857
## [,1]
## [1,] 0.9996106
## [1] "North"
## [,1]
## [1,] 0.9958978
## [,1]
## [1,] 0.9945197
## [,1]
## [1,] 0.999494
## [1] "South"
## [,1]
## [1,] 0.9967635
## [,1]
## [1,] 0.9965366
## [,1]
## [1,] 0.99925
## [1] "West"
## [,1]
## [1,] 0.9964103
## [,1]
## [1,] 0.994996
## [,1]
## [1,] 0.9983814
(only sig correlations shown… no correction for multiple comparisons)
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
## Warning: `expand_scale()` is deprecated; use `expansion()` instead.
Other notes:
Detrended fish indices are NOT correlated in S!
Nitrate and ammonia are positively correlated, max at lag 0 all regions.
Nitrate and dophos are positively correlated, max at lag 0 all regions.
Ammonia and dophos are positively correlated, lag 0 for FW and S, ammonia lags dphos by 3 months in W and N.
Chla nitrate neg correlated, lag 0.
Chla ammonia neg correlated, lag 0.
Chla dophos relationship unclear.
High flow 2-4 month prev = high chla
Hcope lags chla by 1, positive, except FW.
Clad seem to precede chla by 2, positive.
Amphi relationship unclear, prob bc not eating chla in water column.
In N and W, chla lags potam, negative. The opposite in W.
Mysid and hcope postive, lag 0.
In S and W, hcope lags pcope, negative.
modFW='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*marfish_bsmt_1+ft2*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modW='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modN='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modS='hzoop~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt~fb1*chla_1+fb2*hzoop_1+fb3*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2+fb3^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 191 312
##
## Model Test User Model:
##
## Test statistic 7.216
## Degrees of freedom 7
## P-value (Chi-square) 0.407
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.031 0.076 0.409 0.683 0.031 0.026
## hzoop_1 (hs1) 0.315 0.065 4.859 0.000 0.315 0.327
## pzoop_1 (ht1) 0.057 0.062 0.910 0.363 0.057 0.060
## potam_1 (ht2) -0.187 0.058 -3.216 0.001 -0.187 -0.210
## estfs__1 (ht3) -0.169 0.069 -2.442 0.015 -0.169 -0.168
## flow (ha1) -0.032 0.075 -0.419 0.675 -0.032 -0.030
## temp (ha2) -0.091 0.072 -1.257 0.209 -0.091 -0.086
## turbid (ha3) 0.050 0.081 0.616 0.538 0.050 0.044
## pzoop ~
## hzoop_1 (pb1) 0.050 0.067 0.751 0.453 0.050 0.050
## pzoop_1 (ps1) 0.344 0.065 5.283 0.000 0.344 0.348
## potam_1 (pt1) -0.103 0.060 -1.707 0.088 -0.103 -0.110
## estfs__1 (pt2) -0.031 0.072 -0.432 0.666 -0.031 -0.030
## flow (pa1) 0.083 0.078 1.057 0.290 0.083 0.076
## temp (pa2) -0.018 0.075 -0.245 0.807 -0.018 -0.017
## turbid (pa3) 0.251 0.084 2.998 0.003 0.251 0.215
## estfish_bsmt ~
## hzoop_1 (fb1) -0.183 0.056 -3.261 0.001 -0.183 -0.198
## pzoop_1 (fb2) 0.117 0.056 2.089 0.037 0.117 0.129
## estfs__1 (fs1) 0.341 0.064 5.344 0.000 0.341 0.353
## flow (fa1) 0.090 0.068 1.323 0.186 0.090 0.090
## temp (fa2) -0.034 0.065 -0.531 0.595 -0.034 -0.034
## turbid (fa3) 0.250 0.073 3.437 0.001 0.250 0.233
## mrfsh__1 (ft1) 0.001 0.064 0.016 0.988 0.001 0.001
## sbss1__1 (ft2) -0.019 0.064 -0.293 0.769 -0.019 -0.019
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop -0.030 0.058 -0.507 0.612 -0.030 -0.037
## .estfish_bsmt -0.048 0.050 -0.970 0.332 -0.048 -0.070
## .pzoop ~~
## .estfish_bsmt -0.088 0.052 -1.693 0.090 -0.088 -0.123
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.774 0.079 9.772 0.000 0.774 0.755
## .pzoop 0.842 0.086 9.772 0.000 0.842 0.750
## .estfish_bsmt 0.603 0.062 9.772 0.000 0.603 0.639
##
## R-Square:
## Estimate
## hzoop 0.245
## pzoop 0.250
## estfish_bsmt 0.361
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.031 0.076 0.409 0.683 0.031 0.026
## hs 0.315 0.065 4.859 0.000 0.315 0.327
## ht 0.258 0.057 4.498 0.000 0.258 0.276
## ha 0.108 0.073 1.479 0.139 0.108 0.101
## pb 0.050 0.067 0.751 0.453 0.050 0.050
## ps 0.344 0.065 5.283 0.000 0.344 0.348
## pt 0.107 0.058 1.847 0.065 0.107 0.114
## pa 0.265 0.073 3.617 0.000 0.265 0.228
## fb 0.217 0.058 3.715 0.000 0.217 0.236
## fs 0.341 0.064 5.344 0.000 0.341 0.353
## ft 0.019 0.064 0.295 0.768 0.019 0.019
## fa 0.268 0.062 4.295 0.000 0.268 0.252
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 17 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 210 312
##
## Model Test User Model:
##
## Test statistic 2.747
## Degrees of freedom 4
## P-value (Chi-square) 0.601
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.052 0.068 0.773 0.440 0.052 0.047
## hzoop_1 (hs1) 0.417 0.071 5.897 0.000 0.417 0.400
## pzoop_1 (ht1) 0.021 0.064 0.330 0.741 0.021 0.020
## potam_1 (ht2) -0.181 0.068 -2.651 0.008 -0.181 -0.168
## estfs__1 (ht3) 0.020 0.063 0.317 0.752 0.020 0.019
## flow (ha1) 0.197 0.070 2.818 0.005 0.197 0.184
## temp (ha2) 0.005 0.061 0.089 0.929 0.005 0.005
## turbid (ha3) -0.177 0.069 -2.587 0.010 -0.177 -0.163
## pzoop ~
## chla_1 (pb1) 0.195 0.065 3.021 0.003 0.195 0.181
## hzoop_1 (pb2) 0.114 0.068 1.672 0.095 0.114 0.113
## pzoop_1 (ps1) 0.418 0.062 6.752 0.000 0.418 0.414
## potam_1 (pt1) -0.091 0.065 -1.395 0.163 -0.091 -0.087
## estfs__1 (pt2) 0.038 0.061 0.620 0.535 0.038 0.037
## flow (pa1) -0.102 0.067 -1.515 0.130 -0.102 -0.098
## temp (pa2) 0.188 0.059 3.188 0.001 0.188 0.191
## turbid (pa3) 0.031 0.066 0.464 0.643 0.031 0.029
## estfish_bsmt ~
## hzoop_1 (fb1) 0.142 0.071 2.002 0.045 0.142 0.138
## pzoop_1 (fb2) -0.078 0.068 -1.146 0.252 -0.078 -0.076
## estfs__1 (fs1) 0.175 0.072 2.429 0.015 0.175 0.169
## flow (fa1) -0.219 0.073 -2.984 0.003 -0.219 -0.207
## temp (fa2) 0.020 0.064 0.317 0.751 0.020 0.020
## turbid (fa3) 0.243 0.071 3.441 0.001 0.243 0.228
## sbss1__1 (ft1) 0.240 0.069 3.492 0.000 0.240 0.230
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.177 0.049 3.588 0.000 0.177 0.256
## .estfish_bsmt -0.088 0.053 -1.662 0.096 -0.088 -0.115
## .pzoop ~~
## .estfish_bsmt 0.137 0.052 2.656 0.008 0.137 0.186
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.720 0.070 10.247 0.000 0.720 0.675
## .pzoop 0.667 0.065 10.247 0.000 0.667 0.669
## .estfish_bsmt 0.811 0.079 10.247 0.000 0.811 0.785
##
## R-Square:
## Estimate
## hzoop 0.325
## pzoop 0.331
## estfish_bsmt 0.215
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.052 0.068 0.773 0.440 0.052 0.047
## hs 0.417 0.071 5.897 0.000 0.417 0.400
## ht 0.183 0.067 2.742 0.006 0.183 0.171
## ha 0.265 0.076 3.474 0.001 0.265 0.246
## pb 0.226 0.057 3.937 0.000 0.226 0.213
## ps 0.418 0.062 6.752 0.000 0.418 0.414
## pt 0.098 0.062 1.589 0.112 0.098 0.095
## pa 0.216 0.062 3.477 0.001 0.216 0.217
## fb 0.162 0.079 2.057 0.040 0.162 0.158
## fs 0.175 0.072 2.429 0.015 0.175 0.169
## ft 0.240 0.069 3.492 0.000 0.240 0.230
## fa 0.328 0.081 4.031 0.000 0.328 0.309
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 15 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 31
##
## Used Total
## Number of observations 193 312
##
## Model Test User Model:
##
## Test statistic 9.502
## Degrees of freedom 8
## P-value (Chi-square) 0.302
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.041 0.073 0.564 0.573 0.041 0.038
## hzoop_1 (hs1) 0.213 0.071 3.011 0.003 0.213 0.208
## pzoop_1 (ht1) 0.033 0.073 0.446 0.656 0.033 0.032
## corbic_1 (ht2) 0.004 0.068 0.056 0.956 0.004 0.004
## estfs__1 (ht3) -0.078 0.068 -1.143 0.253 -0.078 -0.083
## flow (ha1) 0.237 0.076 3.121 0.002 0.237 0.236
## temp (ha2) 0.108 0.066 1.630 0.103 0.108 0.111
## turbid (ha3) 0.196 0.070 2.796 0.005 0.196 0.190
## pzoop ~
## chla_1 (pb1) 0.268 0.064 4.165 0.000 0.268 0.246
## hzoop_1 (pb2) 0.177 0.062 2.831 0.005 0.177 0.173
## pzoop_1 (ps1) 0.233 0.065 3.592 0.000 0.233 0.229
## corbic_1 (pt1) 0.030 0.060 0.501 0.616 0.030 0.030
## estfs__1 (pt2) -0.060 0.060 -0.996 0.319 -0.060 -0.064
## flow (pa1) -0.435 0.067 -6.489 0.000 -0.435 -0.434
## temp (pa2) 0.081 0.059 1.377 0.169 0.081 0.083
## turbid (pa3) 0.003 0.062 0.048 0.962 0.003 0.003
## estfish_bsmt ~
## hzoop_1 (fb1) 0.154 0.074 2.089 0.037 0.154 0.141
## pzoop_1 (fb2) 0.012 0.075 0.160 0.873 0.012 0.011
## estfs__1 (fs1) 0.127 0.071 1.790 0.073 0.127 0.127
## flow (fa1) -0.468 0.078 -5.996 0.000 -0.468 -0.436
## temp (fa2) -0.017 0.067 -0.251 0.802 -0.017 -0.016
## turbid (fa3) 0.067 0.073 0.920 0.357 0.067 0.061
## sside_1 (ft1) -0.018 0.068 -0.260 0.795 -0.018 -0.017
## cent_1 (ft2) -0.127 0.069 -1.837 0.066 -0.127 -0.121
## sbss1__1 (ft3) 0.095 0.071 1.331 0.183 0.095 0.090
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.178 0.053 3.339 0.001 0.178 0.248
## .estfish_bsmt -0.057 0.059 -0.967 0.334 -0.057 -0.070
## .pzoop ~~
## .estfish_bsmt -0.002 0.052 -0.047 0.962 -0.002 -0.003
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.813 0.083 9.823 0.000 0.813 0.820
## .pzoop 0.633 0.064 9.823 0.000 0.633 0.643
## .estfish_bsmt 0.831 0.085 9.823 0.000 0.831 0.732
##
## R-Square:
## Estimate
## hzoop 0.180
## pzoop 0.357
## estfish_bsmt 0.268
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.041 0.073 0.564 0.573 0.041 0.038
## hs 0.213 0.071 3.011 0.003 0.213 0.208
## ht 0.085 0.075 1.133 0.257 0.085 0.089
## ha 0.326 0.071 4.605 0.000 0.326 0.323
## pb 0.321 0.062 5.164 0.000 0.321 0.301
## ps 0.233 0.065 3.592 0.000 0.233 0.229
## pt 0.067 0.063 1.074 0.283 0.067 0.071
## pa 0.442 0.065 6.834 0.000 0.442 0.442
## fb 0.155 0.072 2.138 0.032 0.155 0.142
## fs 0.127 0.071 1.790 0.073 0.127 0.127
## ft 0.160 0.063 2.515 0.012 0.160 0.152
## fa 0.473 0.080 5.931 0.000 0.473 0.440
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
##
## Used Total
## Number of observations 199 312
##
## Model Test User Model:
##
## Test statistic 5.655
## Degrees of freedom 7
## P-value (Chi-square) 0.581
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop ~
## chla_1 (hb1) 0.251 0.073 3.437 0.001 0.251 0.232
## hzoop_1 (hs1) 0.208 0.070 2.986 0.003 0.208 0.198
## pzoop_1 (ht1) -0.023 0.077 -0.304 0.761 -0.023 -0.021
## corbic_1 (ht2) 0.084 0.071 1.182 0.237 0.084 0.078
## estfs__1 (ht3) 0.003 0.070 0.042 0.967 0.003 0.003
## flow (ha1) 0.204 0.072 2.825 0.005 0.204 0.186
## temp (ha2) 0.171 0.067 2.533 0.011 0.171 0.167
## turbid (ha3) -0.043 0.069 -0.627 0.531 -0.043 -0.042
## pzoop ~
## chla_1 (pb1) 0.298 0.061 4.909 0.000 0.298 0.298
## hzoop_1 (pb2) 0.138 0.058 2.391 0.017 0.138 0.142
## pzoop_1 (ps1) 0.328 0.064 5.152 0.000 0.328 0.325
## corbic_1 (pt1) -0.060 0.058 -1.036 0.300 -0.060 -0.060
## estfs__1 (pt2) 0.019 0.058 0.336 0.737 0.019 0.021
## flow (pa1) -0.129 0.060 -2.137 0.033 -0.129 -0.126
## temp (pa2) -0.034 0.056 -0.614 0.539 -0.034 -0.036
## turbid (pa3) 0.094 0.057 1.652 0.099 0.094 0.098
## estfish_bsmt ~
## chla_1 (fb1) 0.144 0.070 2.045 0.041 0.144 0.138
## hzoop_1 (fb2) 0.138 0.068 2.030 0.042 0.138 0.136
## pzoop_1 (fb3) -0.047 0.073 -0.634 0.526 -0.047 -0.044
## estfs__1 (fs1) 0.191 0.068 2.804 0.005 0.191 0.195
## flow (fa1) -0.092 0.071 -1.312 0.190 -0.092 -0.087
## temp (fa2) -0.027 0.065 -0.421 0.674 -0.027 -0.028
## turbid (fa3) 0.208 0.071 2.913 0.004 0.208 0.209
## sside_1 (ft1) 0.055 0.065 0.856 0.392 0.055 0.055
## cent_1 (ft2) -0.076 0.067 -1.135 0.256 -0.076 -0.079
## sbss1__1 (ft3) 0.067 0.068 0.976 0.329 0.067 0.067
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop ~~
## .pzoop 0.110 0.051 2.133 0.033 0.110 0.153
## .estfish_bsmt 0.042 0.058 0.714 0.475 0.042 0.051
## .pzoop ~~
## .estfish_bsmt 0.133 0.049 2.680 0.007 0.133 0.193
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop 0.863 0.087 9.975 0.000 0.863 0.824
## .pzoop 0.597 0.060 9.975 0.000 0.597 0.664
## .estfish_bsmt 0.786 0.079 9.975 0.000 0.786 0.812
##
## R-Square:
## Estimate
## hzoop 0.176
## pzoop 0.336
## estfish_bsmt 0.188
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.251 0.073 3.437 0.001 0.251 0.232
## hs 0.208 0.070 2.986 0.003 0.208 0.198
## ht 0.087 0.072 1.203 0.229 0.087 0.081
## ha 0.270 0.071 3.774 0.000 0.270 0.253
## pb 0.329 0.058 5.688 0.000 0.329 0.330
## ps 0.328 0.064 5.152 0.000 0.328 0.325
## pt 0.063 0.057 1.102 0.270 0.063 0.064
## pa 0.163 0.062 2.639 0.008 0.163 0.164
## fb 0.204 0.070 2.926 0.003 0.204 0.199
## fs 0.191 0.068 2.804 0.005 0.191 0.195
## ft 0.115 0.065 1.774 0.076 0.115 0.118
## fa 0.229 0.076 3.015 0.003 0.229 0.228
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitS)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="Far West",
manual_port_settings=TRUE)
upper_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="West",
manual_port_settings=TRUE)
upper_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="North",
manual_port_settings=TRUE)
upper_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
upper_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="South",
manual_port_settings=TRUE)
upper_plot_south
Save updated SEM diagrams
Total effects
ssFW=standardizedsolution(modfitFW) %>% mutate(region="Far West")
ssW=standardizedsolution(modfitW) %>% mutate(region="West")
ssN=standardizedsolution(modfitN) %>% mutate(region="North")
ssS=standardizedsolution(modfitS) %>% mutate(region="South")
ssut=rbind(ssFW,ssW,ssN,ssS) %>% filter(op==":=") %>% select(region,lhs,est.std:ci.upper) %>%
separate(lhs,c("variable","influence"), sep=1) %>%
mutate(variable=case_when(variable=="h" ~ "herbivorous\nzooplankton",
variable=="p" ~ "predatory\nzooplankton",
variable=="f" ~ "estuarine\nfishes"),
influence=case_when(influence=="b" ~ "bottom-up",
influence=="t" ~ "top-down",
influence=="s" ~ "self-regulation",
influence=="a" ~ "abiotic drivers"),
region=factor(region, levels=regionorder),
influence=factor(influence, levels=c("self-regulation","bottom-up","top-down","abiotic drivers")),
variable=factor(variable,levels=c("estuarine\nfishes","predatory\nzooplankton","herbivorous\nzooplankton")),
sig=ifelse(pvalue<0.05,"*",""))
ggplot(ssut,aes(x=influence,y=est.std)) +
facet_grid(variable~region) +
geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width=0.5) +
geom_point() +
geom_text(aes(y=ci.upper+0.05, label=sig)) +
geom_hline(yintercept = 0) +
theme_bw() + theme(axis.text.x=element_text(angle=90, vjust=0.5, hjust=1)) +
labs(y="total effect (standardized)")
ggsave("./fig_output/uteffects.png",width = 6,height=5)
modFW='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modW='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*din_1+lb2*chla_1+lb3*hzoop_1+lb4*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2+lb4^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modN='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ct3*pzoop_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2+ct3^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modS='din~ns1*din_1+nt1*chla+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 12 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 234 312
##
## Model Test User Model:
##
## Test statistic 1.418
## Degrees of freedom 4
## P-value (Chi-square) 0.841
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.426 0.057 7.402 0.000 0.426 0.426
## chla (nt1) -0.163 0.072 -2.274 0.023 -0.163 -0.130
## hzoop_1 (nn1) 0.033 0.059 0.553 0.580 0.033 0.033
## pzoop_1 (nn2) -0.022 0.058 -0.383 0.702 -0.022 -0.023
## potam_1 (nn3) -0.005 0.057 -0.090 0.928 -0.005 -0.005
## flow (na1) -0.012 0.067 -0.182 0.856 -0.012 -0.012
## temp (na2) -0.156 0.064 -2.437 0.015 -0.156 -0.149
## turbid (na3) -0.139 0.068 -2.044 0.041 -0.139 -0.130
## chla ~
## din_1 (cb1) 0.016 0.051 0.312 0.755 0.016 0.020
## chla_1 (cs1) 0.258 0.063 4.106 0.000 0.258 0.263
## hzoop_1 (ct1) -0.012 0.052 -0.225 0.822 -0.012 -0.015
## potam_1 (ct2) -0.018 0.050 -0.356 0.722 -0.018 -0.023
## flow (ca1) 0.062 0.058 1.078 0.281 0.062 0.073
## temp (ca2) 0.128 0.056 2.277 0.023 0.128 0.153
## turbid (ca3) -0.047 0.060 -0.790 0.429 -0.047 -0.055
## potam ~
## chla_1 (lb1) 0.066 0.060 1.102 0.271 0.066 0.052
## hzoop_1 (lb2) -0.080 0.051 -1.561 0.119 -0.080 -0.077
## pzoop_1 (lb3) -0.162 0.050 -3.243 0.001 -0.162 -0.160
## potam_1 (ls1) 0.628 0.048 13.003 0.000 0.628 0.628
## flow (la1) 0.112 0.057 1.959 0.050 0.112 0.102
## temp (la2) -0.043 0.054 -0.787 0.432 -0.043 -0.040
## turbid (la3) 0.038 0.058 0.656 0.512 0.038 0.035
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .potam -0.044 0.044 -1.016 0.310 -0.044 -0.067
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.778 0.072 10.817 0.000 0.778 0.753
## .chla 0.602 0.056 10.817 0.000 0.602 0.908
## .potam 0.567 0.052 10.817 0.000 0.567 0.517
##
## R-Square:
## Estimate
## din 0.247
## chla 0.092
## potam 0.483
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.426 0.057 7.402 0.000 0.426 0.426
## nt 0.163 0.072 2.274 0.023 0.163 0.130
## nn 0.040 0.061 0.658 0.511 0.040 0.040
## na 0.209 0.072 2.893 0.004 0.209 0.199
## cb 0.016 0.051 0.312 0.755 0.016 0.020
## cs 0.258 0.063 4.106 0.000 0.258 0.263
## ct 0.021 0.055 0.385 0.700 0.021 0.027
## ca 0.150 0.057 2.607 0.009 0.150 0.178
## lb 0.192 0.049 3.891 0.000 0.192 0.185
## ls 0.628 0.048 13.003 0.000 0.628 0.628
## la 0.126 0.049 2.580 0.010 0.126 0.115
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 257 312
##
## Model Test User Model:
##
## Test statistic 6.550
## Degrees of freedom 3
## P-value (Chi-square) 0.088
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.410 0.052 7.856 0.000 0.410 0.410
## chla (nt1) -0.144 0.052 -2.763 0.006 -0.144 -0.130
## hzoop_1 (nn1) 0.018 0.051 0.347 0.729 0.018 0.018
## pzoop_1 (nn2) 0.041 0.048 0.847 0.397 0.041 0.041
## potam_1 (nn3) 0.078 0.053 1.473 0.141 0.078 0.078
## flow (na1) -0.358 0.054 -6.608 0.000 -0.358 -0.349
## temp (na2) 0.027 0.047 0.580 0.562 0.027 0.027
## turbid (na3) 0.106 0.050 2.115 0.034 0.106 0.106
## chla ~
## din_1 (cb1) -0.126 0.062 -2.029 0.042 -0.126 -0.140
## chla_1 (cs1) 0.149 0.065 2.301 0.021 0.149 0.149
## hzoop_1 (ct1) 0.092 0.058 1.581 0.114 0.092 0.105
## potam_1 (ct2) 0.035 0.062 0.558 0.577 0.035 0.039
## flow (ca1) 0.049 0.063 0.774 0.439 0.049 0.053
## temp (ca2) -0.059 0.055 -1.083 0.279 -0.059 -0.067
## turbid (ca3) -0.029 0.059 -0.480 0.631 -0.029 -0.032
## potam ~
## din_1 (lb1) 0.073 0.044 1.672 0.095 0.073 0.072
## chla_1 (lb2) -0.008 0.045 -0.165 0.869 -0.008 -0.007
## hzoop_1 (lb3) -0.031 0.043 -0.710 0.477 -0.031 -0.031
## pzoop_1 (lb4) 0.078 0.040 1.942 0.052 0.078 0.078
## potam_1 (ls1) 0.703 0.044 16.008 0.000 0.703 0.698
## flow (la1) -0.108 0.045 -2.405 0.016 -0.108 -0.104
## temp (la2) -0.011 0.039 -0.284 0.777 -0.011 -0.011
## turbid (la3) -0.079 0.042 -1.903 0.057 -0.079 -0.078
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .potam 0.038 0.027 1.401 0.161 0.038 0.088
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.523 0.046 11.336 0.000 0.523 0.525
## .chla 0.726 0.064 11.336 0.000 0.726 0.900
## .potam 0.358 0.032 11.336 0.000 0.358 0.351
##
## R-Square:
## Estimate
## din 0.475
## chla 0.100
## potam 0.649
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.410 0.052 7.856 0.000 0.410 0.410
## nt 0.144 0.052 2.763 0.006 0.144 0.130
## nn 0.090 0.053 1.686 0.092 0.090 0.090
## na 0.374 0.056 6.643 0.000 0.374 0.366
## cb 0.126 0.062 2.029 0.042 0.126 0.140
## cs 0.149 0.065 2.301 0.021 0.149 0.149
## ct 0.099 0.063 1.562 0.118 0.099 0.112
## ca 0.082 0.062 1.333 0.183 0.082 0.091
## lb 0.112 0.043 2.598 0.009 0.112 0.111
## ls 0.703 0.044 16.008 0.000 0.703 0.698
## la 0.134 0.040 3.337 0.001 0.134 0.130
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 11 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 255 312
##
## Model Test User Model:
##
## Test statistic 5.353
## Degrees of freedom 3
## P-value (Chi-square) 0.148
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.129 0.053 2.415 0.016 0.129 0.130
## chla (nt1) -0.173 0.050 -3.484 0.000 -0.173 -0.174
## hzoop_1 (nn1) 0.051 0.052 0.991 0.322 0.051 0.051
## pzoop_1 (nn2) 0.176 0.054 3.239 0.001 0.176 0.174
## corbic_1 (nn3) -0.027 0.051 -0.521 0.602 -0.027 -0.026
## flow (na1) -0.469 0.057 -8.188 0.000 -0.469 -0.460
## temp (na2) 0.028 0.051 0.539 0.590 0.028 0.028
## turbid (na3) 0.055 0.049 1.127 0.260 0.055 0.056
## chla ~
## din_1 (cb1) 0.025 0.066 0.374 0.708 0.025 0.025
## chla_1 (cs1) 0.279 0.060 4.643 0.000 0.279 0.281
## hzoop_1 (ct1) -0.053 0.063 -0.848 0.396 -0.053 -0.053
## corbic_1 (ct2) 0.016 0.062 0.266 0.790 0.016 0.016
## pzoop_1 (ct3) -0.169 0.066 -2.567 0.010 -0.169 -0.165
## flow (ca1) -0.054 0.069 -0.777 0.437 -0.054 -0.052
## temp (ca2) 0.136 0.061 2.213 0.027 0.136 0.136
## turbid (ca3) 0.078 0.059 1.312 0.190 0.078 0.079
## corbic ~
## chla_1 (lb1) 0.003 0.053 0.058 0.954 0.003 0.003
## hzoop_1 (lb2) 0.015 0.056 0.265 0.791 0.015 0.015
## pzoop_1 (lb3) -0.012 0.058 -0.199 0.842 -0.012 -0.012
## corbic_1 (ls1) 0.463 0.056 8.313 0.000 0.463 0.460
## flow (la1) 0.092 0.060 1.536 0.124 0.092 0.091
## temp (la2) -0.034 0.055 -0.612 0.540 -0.034 -0.034
## turbid (la3) -0.117 0.053 -2.214 0.027 -0.117 -0.121
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .corbic -0.017 0.041 -0.422 0.673 -0.017 -0.026
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.602 0.053 11.292 0.000 0.602 0.610
## .chla 0.882 0.078 11.292 0.000 0.882 0.879
## .corbic 0.715 0.063 11.292 0.000 0.715 0.740
##
## R-Square:
## Estimate
## din 0.390
## chla 0.121
## corbic 0.260
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.129 0.053 2.415 0.016 0.129 0.130
## nt 0.173 0.050 3.484 0.000 0.173 0.174
## nn 0.185 0.050 3.668 0.000 0.185 0.183
## na 0.473 0.057 8.232 0.000 0.473 0.464
## cb 0.025 0.066 0.374 0.708 0.025 0.025
## cs 0.279 0.060 4.643 0.000 0.279 0.281
## ct 0.178 0.061 2.914 0.004 0.178 0.174
## ca 0.165 0.061 2.726 0.006 0.165 0.165
## lb 0.019 0.063 0.305 0.761 0.019 0.019
## ls 0.463 0.056 8.313 0.000 0.463 0.460
## la 0.152 0.057 2.687 0.007 0.152 0.155
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 10 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 256 312
##
## Model Test User Model:
##
## Test statistic 2.594
## Degrees of freedom 4
## P-value (Chi-square) 0.628
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din ~
## din_1 (ns1) 0.202 0.061 3.304 0.001 0.202 0.203
## chla (nt1) 0.026 0.059 0.434 0.664 0.026 0.025
## hzoop_1 (nn1) -0.021 0.064 -0.321 0.748 -0.021 -0.019
## pzoop_1 (nn2) 0.027 0.064 0.419 0.675 0.027 0.025
## corbic_1 (nn3) 0.072 0.060 1.209 0.227 0.072 0.072
## flow (na1) -0.006 0.061 -0.106 0.916 -0.006 -0.006
## temp (na2) 0.096 0.060 1.608 0.108 0.096 0.094
## turbid (na3) 0.252 0.063 4.014 0.000 0.252 0.250
## chla ~
## din_1 (cb1) -0.007 0.062 -0.117 0.907 -0.007 -0.007
## chla_1 (cs1) 0.286 0.061 4.725 0.000 0.286 0.286
## hzoop_1 (ct1) 0.073 0.064 1.139 0.255 0.073 0.070
## corbic_1 (ct2) 0.086 0.060 1.430 0.153 0.086 0.087
## flow (ca1) -0.117 0.061 -1.917 0.055 -0.117 -0.115
## temp (ca2) 0.020 0.059 0.344 0.731 0.020 0.020
## turbid (ca3) 0.016 0.063 0.245 0.807 0.016 0.016
## corbic ~
## chla_1 (lb1) 0.054 0.059 0.913 0.361 0.054 0.054
## hzoop_1 (lb2) -0.030 0.061 -0.495 0.621 -0.030 -0.029
## pzoop_1 (lb3) -0.041 0.063 -0.649 0.517 -0.041 -0.038
## corbic_1 (ls1) 0.316 0.058 5.486 0.000 0.316 0.319
## flow (la1) 0.082 0.058 1.409 0.159 0.082 0.081
## temp (la2) -0.078 0.058 -1.350 0.177 -0.078 -0.077
## turbid (la3) 0.185 0.058 3.200 0.001 0.185 0.185
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din ~~
## .corbic -0.074 0.053 -1.405 0.160 -0.074 -0.088
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din 0.869 0.077 11.314 0.000 0.869 0.845
## .chla 0.880 0.078 11.314 0.000 0.880 0.881
## .corbic 0.812 0.072 11.314 0.000 0.812 0.808
##
## R-Square:
## Estimate
## din 0.155
## chla 0.119
## corbic 0.192
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.202 0.061 3.304 0.001 0.202 0.203
## nt 0.026 0.059 0.434 0.664 0.026 0.025
## nn 0.080 0.063 1.272 0.203 0.080 0.079
## na 0.270 0.064 4.232 0.000 0.270 0.267
## cb 0.007 0.062 0.117 0.907 0.007 0.007
## cs 0.286 0.061 4.725 0.000 0.286 0.286
## ct 0.113 0.059 1.912 0.056 0.113 0.112
## ca 0.119 0.061 1.942 0.052 0.119 0.118
## lb 0.074 0.066 1.127 0.260 0.074 0.072
## ls 0.316 0.058 5.486 0.000 0.316 0.319
## la 0.217 0.055 3.921 0.000 0.217 0.217
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="Far West",
manual_port_settings=TRUE)
lower_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="West",
manual_port_settings=TRUE)
lower_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="North",
manual_port_settings=TRUE)
lower_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
lower_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="South",
manual_port_settings=TRUE)
lower_plot_south
Save updated SEM diagrams
Total effects
ssFW=standardizedsolution(modfitFW) %>% mutate(region="Far West")
ssW=standardizedsolution(modfitW) %>% mutate(region="West")
ssN=standardizedsolution(modfitN) %>% mutate(region="North")
ssS=standardizedsolution(modfitS) %>% mutate(region="South")
sslt=rbind(ssFW,ssW,ssN,ssS) %>% filter(op==":=") %>% select(region,lhs,est.std:ci.upper) %>%
separate(lhs,c("variable","influence"), sep=1) %>%
mutate(variable=case_when(variable=="n" ~ "DIN",
variable=="c" ~ "phytoplankton",
variable=="l" ~ "clams"),
influence=case_when(influence=="b" ~ "bottom-up",
influence=="t" ~ "top-down",
influence=="s" ~ "self-regulation",
influence=="a" ~ "abiotic drivers",
influence=="n" ~ "nutrient cycling"),
region=factor(region, levels=regionorder),
influence=factor(influence, levels=c("self-regulation","bottom-up","top-down","abiotic drivers","nutrient cycling")),
variable=factor(variable,levels=c("clams","phytoplankton","DIN")),
sig=ifelse(pvalue<0.05,"*",""))
ggplot(sslt,aes(x=influence,y=est.std)) +
facet_grid(variable~region) +
geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper),width=0.5) +
geom_point() +
geom_text(aes(y=ci.upper+0.05, label=sig)) +
geom_hline(yintercept = 0) +
theme_bw() + theme(axis.text.x=element_text(angle=90, vjust=0.5, hjust=1)) +
labs(y="total effect (standardized)")
ggsave("./fig_output/lteffects.png",width = 6,height=5)
#1
# modFW='chla~chla_1+hcope_1+amphi_m_1+potam_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# '
# modW='chla~chla_1+hcope_1+amphi_m_1+potam_1+flow+turbid+temp+mysid_1
# hcope~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1
# mysid~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
# '
# modN='chla~chla_1+hcope_1+amphi_m_1+corbic_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# mysid~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# '
# modS='chla~chla_1+hcope_1+clad_1+corbic_1+flow+turbid+temp
# hcope~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# clad~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
# amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
# pcope~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
# '
#2
modFW='chla~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+flow+turbid+temp
'
modW='chla~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp+mysid_1
hcope~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
amphi_m~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
mysid~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modN='chla~chla_1+hcope_1+amphi_m_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1+chla_1
mysid~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modS='chla~chla_1+hcope_1+clad_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
clad~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
amphi_m~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+clad_1+flow+turbid+temp
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 29 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 64
##
## Used Total
## Number of observations 183 312
##
## Model Test User Model:
##
## Test statistic 24.227
## Degrees of freedom 17
## P-value (Chi-square) 0.113
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.225 0.068 3.311 0.001 0.225 0.233
## hcope_1 0.089 0.056 1.593 0.111 0.089 0.113
## amphi_m_1 -0.011 0.067 -0.162 0.871 -0.011 -0.014
## rotif_m_1 -0.096 0.064 -1.503 0.133 -0.096 -0.112
## potam_1 -0.000 0.050 -0.009 0.993 -0.000 -0.001
## flow 0.104 0.073 1.421 0.155 0.104 0.124
## turbid -0.102 0.072 -1.423 0.155 -0.102 -0.114
## temp 0.106 0.063 1.685 0.092 0.106 0.124
## hcope ~
## chla_1 0.124 0.082 1.509 0.131 0.124 0.101
## hcope_1 0.231 0.072 3.209 0.001 0.231 0.232
## pcope_1 0.059 0.074 0.798 0.425 0.059 0.057
## potam_1 -0.131 0.064 -2.057 0.040 -0.131 -0.144
## flow -0.063 0.084 -0.749 0.454 -0.063 -0.059
## turbid -0.049 0.088 -0.556 0.578 -0.049 -0.043
## temp -0.068 0.080 -0.857 0.391 -0.068 -0.063
## estfish_bsmt_1 -0.137 0.080 -1.727 0.084 -0.137 -0.132
## amphi_m ~
## chla_1 0.052 0.040 1.307 0.191 0.052 0.043
## amphi_m_1 0.732 0.039 18.979 0.000 0.732 0.748
## flow -0.265 0.043 -6.179 0.000 -0.265 -0.254
## turbid 0.004 0.042 0.084 0.933 0.004 0.003
## temp 0.017 0.037 0.451 0.652 0.017 0.016
## estfish_bsmt_1 0.049 0.036 1.357 0.175 0.049 0.048
## rotif_m ~
## chla_1 -0.201 0.077 -2.600 0.009 -0.201 -0.177
## rotif_m_1 0.344 0.068 5.045 0.000 0.344 0.345
## flow 0.066 0.076 0.866 0.387 0.066 0.067
## turbid 0.055 0.081 0.688 0.492 0.055 0.053
## temp 0.025 0.072 0.348 0.728 0.025 0.025
## estfish_bsmt_1 -0.016 0.069 -0.239 0.811 -0.016 -0.017
## pcope ~
## hcope_1 0.047 0.066 0.708 0.479 0.047 0.050
## pcope_1 0.272 0.068 3.986 0.000 0.272 0.279
## potam_1 -0.082 0.058 -1.407 0.159 -0.082 -0.096
## flow 0.204 0.077 2.665 0.008 0.204 0.205
## turbid 0.092 0.081 1.137 0.256 0.092 0.086
## temp 0.150 0.073 2.061 0.039 0.150 0.147
## estfish_bsmt_1 -0.046 0.073 -0.637 0.524 -0.046 -0.048
## estfish_bsmt ~
## estfish_bsmt_1 0.350 0.064 5.423 0.000 0.350 0.357
## hcope_1 -0.090 0.058 -1.551 0.121 -0.090 -0.096
## pcope_1 0.129 0.060 2.140 0.032 0.129 0.132
## amphi_m_1 -0.055 0.069 -0.798 0.425 -0.055 -0.059
## rotif_m_1 -0.148 0.063 -2.335 0.020 -0.148 -0.144
## flow 0.085 0.074 1.154 0.248 0.085 0.085
## turbid 0.234 0.072 3.238 0.001 0.234 0.218
## temp -0.064 0.065 -0.996 0.319 -0.064 -0.063
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.031 0.055 0.563 0.573 0.031 0.042
## .amphi_m 0.012 0.026 0.471 0.638 0.012 0.035
## .rotif_m 0.099 0.051 1.949 0.051 0.099 0.146
## .pcope -0.007 0.051 -0.138 0.890 -0.007 -0.010
## .estfish_bsmt -0.046 0.045 -1.025 0.306 -0.046 -0.076
## .hcope ~~
## .amphi_m -0.010 0.032 -0.297 0.767 -0.010 -0.022
## .rotif_m 0.068 0.063 1.071 0.284 0.068 0.079
## .pcope -0.205 0.065 -3.147 0.002 -0.205 -0.239
## .estfish_bsmt -0.064 0.056 -1.144 0.253 -0.064 -0.085
## .amphi_m ~~
## .rotif_m -0.038 0.030 -1.281 0.200 -0.038 -0.095
## .pcope -0.003 0.030 -0.099 0.921 -0.003 -0.007
## .estfish_bsmt -0.015 0.026 -0.567 0.571 -0.015 -0.042
## .rotif_m ~~
## .pcope 0.033 0.058 0.574 0.566 0.033 0.042
## .estfish_bsmt -0.049 0.051 -0.954 0.340 -0.049 -0.071
## .pcope ~~
## .estfish_bsmt -0.063 0.051 -1.222 0.222 -0.063 -0.091
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.596 0.062 9.566 0.000 0.596 0.883
## .hcope 0.935 0.098 9.566 0.000 0.935 0.852
## .amphi_m 0.204 0.021 9.566 0.000 0.204 0.192
## .rotif_m 0.776 0.081 9.566 0.000 0.776 0.839
## .pcope 0.786 0.082 9.566 0.000 0.786 0.813
## .estfish_bsmt 0.608 0.064 9.566 0.000 0.608 0.624
##
## R-Square:
## Estimate
## chla 0.117
## hcope 0.148
## amphi_m 0.808
## rotif_m 0.161
## pcope 0.187
## estfish_bsmt 0.376
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 27 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 87
##
## Used Total
## Number of observations 202 312
##
## Model Test User Model:
##
## Test statistic 24.239
## Degrees of freedom 18
## P-value (Chi-square) 0.147
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.172 0.069 2.495 0.013 0.172 0.176
## hcope_1 0.019 0.068 0.284 0.776 0.019 0.020
## amphi_m_1 0.125 0.067 1.874 0.061 0.125 0.141
## rotif_m_1 0.096 0.063 1.543 0.123 0.096 0.112
## potam_1 -0.039 0.070 -0.557 0.578 -0.039 -0.042
## flow 0.055 0.069 0.791 0.429 0.055 0.059
## turbid 0.082 0.071 1.157 0.247 0.082 0.087
## temp -0.094 0.061 -1.545 0.122 -0.094 -0.106
## mysid_1 -0.134 0.068 -1.979 0.048 -0.134 -0.144
## hcope ~
## chla_1 0.044 0.071 0.628 0.530 0.044 0.042
## hcope_1 0.281 0.070 3.987 0.000 0.281 0.275
## pcope_1 -0.111 0.063 -1.764 0.078 -0.111 -0.116
## mysid_1 0.078 0.073 1.078 0.281 0.078 0.078
## potam_1 -0.176 0.068 -2.599 0.009 -0.176 -0.176
## flow -0.140 0.072 -1.943 0.052 -0.140 -0.139
## turbid -0.107 0.074 -1.452 0.147 -0.107 -0.106
## temp 0.080 0.063 1.269 0.204 0.080 0.084
## estfish_bsmt_1 0.043 0.064 0.670 0.503 0.043 0.044
## rotif_m_1 0.213 0.061 3.489 0.000 0.213 0.230
## amphi_m ~
## chla_1 -0.045 0.042 -1.076 0.282 -0.045 -0.041
## amphi_m_1 0.778 0.040 19.473 0.000 0.778 0.777
## mysid_1 0.078 0.041 1.936 0.053 0.078 0.075
## flow 0.003 0.041 0.076 0.940 0.003 0.003
## turbid -0.106 0.043 -2.450 0.014 -0.106 -0.101
## temp -0.101 0.038 -2.649 0.008 -0.101 -0.101
## estfish_bsmt_1 -0.184 0.040 -4.577 0.000 -0.184 -0.180
## rotif_m ~
## chla_1 0.032 0.067 0.478 0.632 0.032 0.028
## rotif_m_1 0.457 0.060 7.666 0.000 0.457 0.450
## flow 0.215 0.067 3.197 0.001 0.215 0.195
## turbid -0.156 0.067 -2.338 0.019 -0.156 -0.141
## temp -0.018 0.060 -0.291 0.771 -0.018 -0.017
## estfish_bsmt_1 -0.199 0.061 -3.261 0.001 -0.199 -0.185
## pcope ~
## hcope_1 -0.163 0.062 -2.642 0.008 -0.163 -0.154
## pcope_1 0.432 0.057 7.551 0.000 0.432 0.436
## mysid_1 0.141 0.065 2.182 0.029 0.141 0.135
## potam_1 0.047 0.063 0.747 0.455 0.047 0.045
## flow 0.156 0.064 2.452 0.014 0.156 0.150
## turbid -0.132 0.066 -2.002 0.045 -0.132 -0.125
## temp 0.220 0.056 3.948 0.000 0.220 0.222
## estfish_bsmt_1 0.021 0.059 0.364 0.716 0.021 0.021
## rotif_m_1 0.131 0.055 2.354 0.019 0.131 0.136
## mysid ~
## chla_1 0.174 0.062 2.794 0.005 0.174 0.167
## hcope_1 0.049 0.062 0.790 0.429 0.049 0.049
## pcope_1 0.093 0.056 1.661 0.097 0.093 0.099
## amphi_m_1 -0.113 0.059 -1.926 0.054 -0.113 -0.118
## mysid_1 0.372 0.065 5.730 0.000 0.372 0.373
## flow -0.163 0.061 -2.661 0.008 -0.163 -0.164
## turbid 0.250 0.066 3.788 0.000 0.250 0.249
## temp 0.109 0.057 1.926 0.054 0.109 0.115
## estfish_bsmt_1 0.003 0.059 0.053 0.957 0.003 0.003
## estfish_bsmt ~
## estfish_bsmt_1 0.230 0.071 3.240 0.001 0.230 0.223
## hcope_1 0.109 0.073 1.494 0.135 0.109 0.102
## pcope_1 -0.008 0.069 -0.120 0.904 -0.008 -0.008
## amphi_m_1 -0.193 0.075 -2.588 0.010 -0.193 -0.191
## rotif_m_1 0.032 0.069 0.467 0.640 0.032 0.033
## mysid_1 -0.089 0.077 -1.148 0.251 -0.089 -0.084
## flow -0.206 0.074 -2.792 0.005 -0.206 -0.195
## turbid 0.205 0.078 2.610 0.009 0.205 0.192
## temp 0.019 0.066 0.283 0.777 0.019 0.019
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.153 0.052 2.952 0.003 0.153 0.212
## .amphi_m -0.016 0.031 -0.507 0.612 -0.016 -0.036
## .rotif_m 0.054 0.049 1.101 0.271 0.054 0.078
## .pcope 0.012 0.045 0.264 0.791 0.012 0.019
## .mysid 0.079 0.046 1.730 0.084 0.079 0.123
## .estfish_bsmt 0.061 0.054 1.125 0.261 0.061 0.079
## .hcope ~~
## .amphi_m -0.057 0.032 -1.762 0.078 -0.057 -0.125
## .rotif_m -0.013 0.051 -0.264 0.792 -0.013 -0.019
## .pcope 0.069 0.047 1.450 0.147 0.069 0.103
## .mysid 0.202 0.049 4.085 0.000 0.202 0.300
## .estfish_bsmt -0.035 0.056 -0.628 0.530 -0.035 -0.044
## .amphi_m ~~
## .rotif_m 0.057 0.031 1.832 0.067 0.057 0.130
## .pcope 0.050 0.029 1.751 0.080 0.050 0.124
## .mysid -0.046 0.029 -1.598 0.110 -0.046 -0.113
## .estfish_bsmt -0.020 0.034 -0.589 0.556 -0.020 -0.041
## .rotif_m ~~
## .pcope 0.031 0.045 0.673 0.501 0.031 0.047
## .mysid 0.039 0.046 0.847 0.397 0.039 0.060
## .estfish_bsmt -0.025 0.054 -0.470 0.639 -0.025 -0.033
## .pcope ~~
## .mysid 0.069 0.042 1.617 0.106 0.069 0.115
## .estfish_bsmt 0.021 0.050 0.416 0.677 0.021 0.029
## .mysid ~~
## .estfish_bsmt 0.115 0.051 2.251 0.024 0.115 0.160
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.695 0.069 10.050 0.000 0.695 0.848
## .hcope 0.750 0.075 10.050 0.000 0.750 0.786
## .amphi_m 0.273 0.027 10.050 0.000 0.273 0.265
## .rotif_m 0.699 0.070 10.050 0.000 0.699 0.608
## .pcope 0.596 0.059 10.050 0.000 0.596 0.580
## .mysid 0.602 0.060 10.050 0.000 0.602 0.644
## .estfish_bsmt 0.848 0.084 10.050 0.000 0.848 0.803
##
## R-Square:
## Estimate
## chla 0.152
## hcope 0.214
## amphi_m 0.735
## rotif_m 0.392
## pcope 0.420
## mysid 0.356
## estfish_bsmt 0.197
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 31 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 83
##
## Used Total
## Number of observations 186 312
##
## Model Test User Model:
##
## Test statistic 30.817
## Degrees of freedom 22
## P-value (Chi-square) 0.100
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.200 0.074 2.700 0.007 0.200 0.193
## hcope_1 -0.044 0.094 -0.464 0.642 -0.044 -0.037
## amphi_m_1 0.023 0.074 0.312 0.755 0.023 0.022
## rotif_m_1 -0.003 0.072 -0.042 0.967 -0.003 -0.003
## corbic_1 -0.047 0.070 -0.672 0.501 -0.047 -0.049
## flow 0.018 0.075 0.244 0.808 0.018 0.019
## turbid 0.084 0.070 1.207 0.228 0.084 0.090
## temp 0.145 0.069 2.098 0.036 0.145 0.156
## hcope ~
## chla_1 -0.020 0.046 -0.427 0.669 -0.020 -0.023
## hcope_1 0.166 0.074 2.246 0.025 0.166 0.168
## pcope_1 -0.108 0.046 -2.321 0.020 -0.108 -0.143
## mysid_1 0.049 0.063 0.778 0.436 0.049 0.060
## corbic_1 0.126 0.043 2.904 0.004 0.126 0.155
## flow -0.380 0.051 -7.428 0.000 -0.380 -0.479
## turbid 0.080 0.049 1.616 0.106 0.080 0.102
## temp 0.094 0.046 2.048 0.041 0.094 0.121
## estfish_bsmt_1 0.003 0.047 0.070 0.944 0.003 0.004
## amphi_m ~
## chla_1 0.060 0.062 0.979 0.328 0.060 0.060
## amphi_m_1 0.522 0.061 8.488 0.000 0.522 0.525
## flow 0.037 0.063 0.590 0.555 0.037 0.041
## turbid -0.038 0.058 -0.649 0.516 -0.038 -0.042
## temp -0.038 0.057 -0.672 0.502 -0.038 -0.043
## estfish_bsmt_1 -0.064 0.058 -1.107 0.268 -0.064 -0.075
## rotif_m ~
## chla_1 -0.115 0.069 -1.665 0.096 -0.115 -0.102
## rotif_m_1 0.138 0.067 2.067 0.039 0.138 0.134
## flow 0.519 0.071 7.347 0.000 0.519 0.504
## turbid -0.083 0.064 -1.296 0.195 -0.083 -0.082
## temp -0.036 0.063 -0.573 0.567 -0.036 -0.036
## estfish_bsmt_1 0.017 0.064 0.273 0.784 0.017 0.018
## pcope ~
## hcope_1 -0.042 0.111 -0.381 0.703 -0.042 -0.032
## pcope_1 0.270 0.070 3.882 0.000 0.270 0.267
## mysid_1 0.130 0.094 1.390 0.165 0.130 0.119
## corbic_1 0.039 0.069 0.569 0.570 0.039 0.036
## flow -0.207 0.078 -2.650 0.008 -0.207 -0.194
## turbid -0.260 0.075 -3.466 0.001 -0.260 -0.247
## temp 0.048 0.070 0.681 0.496 0.048 0.046
## estfish_bsmt_1 -0.102 0.071 -1.437 0.151 -0.102 -0.103
## chla_1 0.189 0.075 2.513 0.012 0.189 0.163
## mysid ~
## hcope_1 0.056 0.089 0.629 0.529 0.056 0.047
## pcope_1 -0.055 0.056 -0.992 0.321 -0.055 -0.061
## mysid_1 0.205 0.075 2.747 0.006 0.205 0.208
## amphi_m_1 -0.090 0.056 -1.619 0.105 -0.090 -0.086
## flow -0.389 0.062 -6.271 0.000 -0.389 -0.405
## turbid 0.216 0.060 3.613 0.000 0.216 0.227
## temp 0.069 0.055 1.258 0.208 0.069 0.074
## estfish_bsmt_1 0.045 0.057 0.792 0.428 0.045 0.050
## estfish_bsmt ~
## estfish_bsmt_1 0.140 0.072 1.935 0.053 0.140 0.139
## hcope_1 0.151 0.113 1.335 0.182 0.151 0.112
## pcope_1 -0.055 0.071 -0.772 0.440 -0.055 -0.053
## amphi_m_1 -0.044 0.076 -0.577 0.564 -0.044 -0.037
## rotif_m_1 0.133 0.074 1.801 0.072 0.133 0.123
## mysid_1 0.129 0.095 1.358 0.174 0.129 0.116
## flow -0.402 0.079 -5.070 0.000 -0.402 -0.371
## turbid 0.085 0.075 1.120 0.263 0.085 0.079
## temp -0.052 0.069 -0.753 0.451 -0.052 -0.050
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.033 0.040 0.815 0.415 0.033 0.060
## .amphi_m -0.016 0.051 -0.320 0.749 -0.016 -0.023
## .rotif_m 0.098 0.057 1.718 0.086 0.098 0.127
## .pcope -0.106 0.062 -1.715 0.086 -0.106 -0.127
## .mysid 0.069 0.049 1.390 0.164 0.069 0.102
## .estfish_bsmt 0.013 0.062 0.208 0.835 0.013 0.015
## .hcope ~~
## .amphi_m 0.036 0.034 1.067 0.286 0.036 0.079
## .rotif_m 0.002 0.038 0.063 0.949 0.002 0.005
## .pcope 0.068 0.041 1.657 0.098 0.068 0.122
## .mysid 0.170 0.035 4.883 0.000 0.170 0.383
## .estfish_bsmt -0.011 0.041 -0.280 0.779 -0.011 -0.021
## .amphi_m ~~
## .rotif_m 0.029 0.048 0.599 0.549 0.029 0.044
## .pcope -0.122 0.053 -2.320 0.020 -0.122 -0.173
## .mysid 0.069 0.042 1.670 0.095 0.069 0.123
## .estfish_bsmt 0.085 0.052 1.614 0.107 0.085 0.119
## .rotif_m ~~
## .pcope 0.029 0.058 0.504 0.614 0.029 0.037
## .mysid 0.009 0.046 0.198 0.843 0.009 0.015
## .estfish_bsmt -0.014 0.058 -0.243 0.808 -0.014 -0.018
## .pcope ~~
## .mysid 0.104 0.050 2.063 0.039 0.104 0.153
## .estfish_bsmt 0.037 0.063 0.589 0.556 0.037 0.043
## .mysid ~~
## .estfish_bsmt 0.049 0.050 0.987 0.324 0.049 0.073
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.830 0.086 9.644 0.000 0.830 0.921
## .hcope 0.365 0.038 9.644 0.000 0.365 0.583
## .amphi_m 0.589 0.061 9.644 0.000 0.589 0.709
## .rotif_m 0.723 0.075 9.644 0.000 0.723 0.682
## .pcope 0.850 0.088 9.644 0.000 0.850 0.754
## .mysid 0.538 0.056 9.644 0.000 0.538 0.584
## .estfish_bsmt 0.855 0.089 9.644 0.000 0.855 0.732
##
## R-Square:
## Estimate
## chla 0.079
## hcope 0.417
## amphi_m 0.291
## rotif_m 0.318
## pcope 0.246
## mysid 0.416
## estfish_bsmt 0.268
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 81
##
## Used Total
## Number of observations 192 312
##
## Model Test User Model:
##
## Test statistic 27.447
## Degrees of freedom 24
## P-value (Chi-square) 0.284
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## chla_1 0.182 0.073 2.502 0.012 0.182 0.177
## hcope_1 0.075 0.069 1.094 0.274 0.075 0.074
## clad_1 0.233 0.067 3.460 0.001 0.233 0.244
## rotif_m_1 -0.089 0.068 -1.314 0.189 -0.089 -0.088
## corbic_1 -0.044 0.067 -0.654 0.513 -0.044 -0.043
## flow -0.117 0.074 -1.578 0.115 -0.117 -0.112
## turbid 0.016 0.067 0.239 0.811 0.016 0.016
## temp 0.081 0.065 1.235 0.217 0.081 0.083
## hcope ~
## chla_1 0.178 0.062 2.894 0.004 0.178 0.177
## hcope_1 0.352 0.063 5.598 0.000 0.352 0.353
## pcope_1 0.033 0.060 0.540 0.589 0.033 0.034
## corbic_1 0.100 0.061 1.635 0.102 0.100 0.101
## flow -0.154 0.065 -2.372 0.018 -0.154 -0.150
## turbid -0.096 0.060 -1.587 0.112 -0.096 -0.099
## temp 0.164 0.059 2.767 0.006 0.164 0.172
## estfish_bsmt_1 -0.175 0.060 -2.917 0.004 -0.175 -0.183
## clad ~
## chla_1 0.210 0.062 3.400 0.001 0.210 0.194
## clad_1 0.518 0.058 8.870 0.000 0.518 0.516
## pcope_1 -0.019 0.057 -0.329 0.742 -0.019 -0.018
## flow 0.211 0.062 3.431 0.001 0.211 0.192
## turbid -0.038 0.058 -0.658 0.510 -0.038 -0.037
## temp 0.105 0.057 1.831 0.067 0.105 0.102
## estfish_bsmt_1 -0.088 0.056 -1.571 0.116 -0.088 -0.086
## amphi_m ~
## chla_1 -0.052 0.074 -0.699 0.484 -0.052 -0.047
## amphi_m_1 0.234 0.069 3.395 0.001 0.234 0.235
## flow -0.052 0.077 -0.676 0.499 -0.052 -0.047
## turbid 0.201 0.074 2.730 0.006 0.201 0.193
## temp 0.100 0.072 1.399 0.162 0.100 0.097
## estfish_bsmt_1 0.057 0.072 0.784 0.433 0.057 0.055
## rotif_m ~
## chla_1 -0.031 0.069 -0.442 0.659 -0.031 -0.030
## rotif_m_1 0.196 0.067 2.921 0.003 0.196 0.194
## flow 0.315 0.071 4.433 0.000 0.315 0.303
## turbid -0.079 0.066 -1.193 0.233 -0.079 -0.081
## temp -0.036 0.066 -0.548 0.584 -0.036 -0.037
## estfish_bsmt_1 0.117 0.066 1.770 0.077 0.117 0.120
## pcope ~
## chla_1 0.271 0.069 3.922 0.000 0.271 0.249
## hcope_1 -0.064 0.067 -0.949 0.343 -0.064 -0.059
## clad_1 0.073 0.066 1.114 0.265 0.073 0.072
## pcope_1 0.476 0.065 7.308 0.000 0.476 0.458
## corbic_1 -0.028 0.064 -0.444 0.657 -0.028 -0.027
## flow 0.008 0.072 0.109 0.913 0.008 0.007
## turbid -0.068 0.066 -1.033 0.302 -0.068 -0.065
## temp 0.003 0.065 0.047 0.962 0.003 0.003
## estfish_bsmt_1 -0.056 0.065 -0.854 0.393 -0.056 -0.054
## estfish_bsmt ~
## estfish_bsmt_1 0.220 0.068 3.254 0.001 0.220 0.226
## hcope_1 -0.005 0.071 -0.073 0.942 -0.005 -0.005
## pcope_1 -0.067 0.069 -0.969 0.333 -0.067 -0.068
## amphi_m_1 0.115 0.064 1.787 0.074 0.115 0.123
## rotif_m_1 -0.008 0.069 -0.121 0.904 -0.008 -0.008
## clad_1 0.131 0.067 1.950 0.051 0.131 0.137
## flow -0.106 0.074 -1.430 0.153 -0.106 -0.102
## turbid 0.218 0.069 3.160 0.002 0.218 0.221
## temp -0.003 0.067 -0.048 0.962 -0.003 -0.003
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla ~~
## .hcope 0.059 0.053 1.124 0.261 0.059 0.081
## .clad 0.159 0.052 3.046 0.002 0.159 0.225
## .amphi_m 0.006 0.064 0.101 0.920 0.006 0.007
## .rotif_m 0.146 0.060 2.426 0.015 0.146 0.178
## .pcope -0.041 0.057 -0.713 0.476 -0.041 -0.052
## .estfish_bsmt -0.012 0.059 -0.201 0.841 -0.012 -0.014
## .hcope ~~
## .clad 0.037 0.045 0.827 0.408 0.037 0.060
## .amphi_m 0.014 0.057 0.253 0.800 0.014 0.018
## .rotif_m 0.007 0.053 0.125 0.901 0.007 0.009
## .pcope 0.008 0.051 0.159 0.874 0.008 0.011
## .estfish_bsmt -0.008 0.053 -0.152 0.879 -0.008 -0.011
## .clad ~~
## .amphi_m -0.082 0.055 -1.492 0.136 -0.082 -0.108
## .rotif_m 0.072 0.051 1.418 0.156 0.072 0.103
## .pcope 0.077 0.049 1.563 0.118 0.077 0.114
## .estfish_bsmt 0.034 0.051 0.665 0.506 0.034 0.048
## .amphi_m ~~
## .rotif_m 0.029 0.064 0.458 0.647 0.029 0.033
## .pcope 0.030 0.062 0.493 0.622 0.030 0.036
## .estfish_bsmt -0.072 0.064 -1.125 0.261 -0.072 -0.081
## .rotif_m ~~
## .pcope 0.153 0.058 2.627 0.009 0.153 0.193
## .estfish_bsmt -0.013 0.059 -0.212 0.832 -0.013 -0.015
## .pcope ~~
## .estfish_bsmt 0.117 0.058 2.032 0.042 0.117 0.148
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla 0.824 0.084 9.798 0.000 0.824 0.850
## .hcope 0.648 0.066 9.798 0.000 0.648 0.695
## .clad 0.601 0.061 9.798 0.000 0.601 0.560
## .amphi_m 0.958 0.098 9.798 0.000 0.958 0.872
## .rotif_m 0.820 0.084 9.798 0.000 0.820 0.851
## .pcope 0.762 0.078 9.798 0.000 0.762 0.701
## .estfish_bsmt 0.817 0.083 9.798 0.000 0.817 0.839
##
## R-Square:
## Estimate
## chla 0.150
## hcope 0.305
## clad 0.440
## amphi_m 0.128
## rotif_m 0.149
## pcope 0.299
## estfish_bsmt 0.161
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
# myLavaanPlot(model=modfitFW, labels=labelsfarwest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="Far West",
title="Far West",
manual_port_settings=TRUE)
zoop_plot_far_west
#WEST
# myLavaanPlot(model=modfitW, labels=labelswest,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="West",
title="West",
manual_port_settings=TRUE)
zoop_plot_west
#NORTH
# myLavaanPlot(model=modfitN, labels=labelsnorth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_zoop",
region="North",
title="North",
manual_port_settings=TRUE)
zoop_plot_north
#SOUTH
# myLavaanPlot(model=modfitS, labels=labelssouth,
# node_options=list(shape="box", fontname="Helvetica"),
# coefs=TRUE, stand=TRUE, covs=FALSE, sig=0.05,
# width=c("regress","latent"),
# color=c("regress","latent"))
zoop_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_zoop",
region="South",
title="South",
manual_port_settings=TRUE)
zoop_plot_south
Save updated SEM diagrams
zoop_grobs <- map(list(zoop_plot_far_west,
zoop_plot_west,
zoop_plot_north,
zoop_plot_south), ~convert_html_to_grob(.x, 2000))
zoop_figure <- ggarrange(plotlist=zoop_grobs, labels="auto",
font.label=list(size=11)) %>%
annotate_figure(top = text_grob("Monthly Regional Models (zooplankton groups)",
color = "black",
face = "bold",
size = 11))
ggsave('./fig_output/sem_zoop.png',zoop_figure, width=8, height=7, dpi=300, bg = "white")
Total effects
Haven’t done yet.
modFW='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*marfish_bsmt_1+ft2*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modW='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*potam_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*potam_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modN='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*hzoop_1+fb2*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modS='hzoop_gr~hb1*chla_1+hs1*hzoop_1+ht1*pzoop_1+ht2*corbic_1+ht3*estfish_bsmt_1+ha1*flow+ha2*temp+ha3*turbid
pzoop_gr~pb1*chla_1+pb2*hzoop_1+ps1*pzoop_1+pt1*corbic_1+pt2*estfish_bsmt_1+pa1*flow+pa2*temp+pa3*turbid
estfish_bsmt_gr~fb1*chla_1+fb2*hzoop_1+fb3*pzoop_1+fs1*estfish_bsmt_1+fa1*flow+fa2*temp+fa3*turbid+ft1*sside_1+ft2*cent_1+ft3*sbass1_bsmt_1
hb:=sqrt(hb1^2)
hs:=sqrt(hs1^2)
ht:=sqrt(ht1^2+ht2^2+ht3^2)
ha:=sqrt(ha1^2+ha2^2+ha3^2)
pb:=sqrt(pb1^2+pb2^2)
ps:=sqrt(ps1^2)
pt:=sqrt(pt1^2+pt2^2)
pa:=sqrt(pa1^2+pa2^2+pa3^2)
fb:=sqrt(fb1^2+fb2^2+fb3^2)
fs:=sqrt(fs1^2)
ft:=sqrt(ft1^2+ft2^2+ft3^2)
fa:=sqrt(fa1^2+fa2^2+fa3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 24 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 191 312
##
## Model Test User Model:
##
## Test statistic 6.547
## Degrees of freedom 7
## P-value (Chi-square) 0.478
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.047 0.058 0.796 0.426 0.047 0.046
## hzoop_1 (hs1) -0.504 0.050 -10.079 0.000 -0.504 -0.618
## pzoop_1 (ht1) 0.062 0.048 1.291 0.197 0.062 0.078
## potam_1 (ht2) -0.134 0.045 -2.990 0.003 -0.134 -0.178
## estfs__1 (ht3) -0.123 0.053 -2.304 0.021 -0.123 -0.145
## flow (ha1) -0.047 0.058 -0.816 0.415 -0.047 -0.054
## temp (ha2) -0.057 0.055 -1.027 0.304 -0.057 -0.064
## turbid (ha3) 0.052 0.062 0.844 0.399 0.052 0.056
## pzoop_gr ~
## hzoop_1 (pb1) 0.068 0.103 0.662 0.508 0.068 0.042
## pzoop_1 (ps1) -0.898 0.100 -9.013 0.000 -0.898 -0.567
## potam_1 (pt1) -0.181 0.092 -1.973 0.048 -0.181 -0.121
## estfs__1 (pt2) 0.016 0.110 0.148 0.882 0.016 0.010
## flow (pa1) 0.119 0.120 0.990 0.322 0.119 0.068
## temp (pa2) -0.013 0.115 -0.114 0.909 -0.013 -0.007
## turbid (pa3) 0.329 0.128 2.564 0.010 0.329 0.175
## estfish_bsmt_gr ~
## hzoop_1 (fb1) -0.421 0.133 -3.170 0.002 -0.421 -0.193
## pzoop_1 (fb2) 0.242 0.132 1.834 0.067 0.242 0.113
## estfs__1 (fs1) -1.370 0.151 -9.097 0.000 -1.370 -0.601
## flow (fa1) 0.171 0.160 1.069 0.285 0.171 0.073
## temp (fa2) -0.033 0.153 -0.214 0.831 -0.033 -0.014
## turbid (fa3) 0.482 0.172 2.807 0.005 0.482 0.190
## mrfsh__1 (ft1) -0.032 0.150 -0.213 0.831 -0.032 -0.013
## sbss1__1 (ft2) -0.043 0.152 -0.285 0.776 -0.043 -0.018
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr -0.080 0.069 -1.161 0.246 -0.080 -0.084
## .estfsh_bsmt_gr -0.046 0.090 -0.514 0.607 -0.046 -0.037
## .pzoop_gr ~~
## .estfsh_bsmt_gr -0.401 0.189 -2.126 0.034 -0.401 -0.156
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.460 0.047 9.772 0.000 0.460 0.628
## .pzoop_gr 1.974 0.202 9.772 0.000 1.974 0.685
## .estfsh_bsmt_gr 3.366 0.344 9.772 0.000 3.366 0.641
##
## R-Square:
## Estimate
## hzoop_gr 0.372
## pzoop_gr 0.315
## estfsh_bsmt_gr 0.359
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.047 0.058 0.796 0.426 0.047 0.046
## hs 0.504 0.050 10.079 0.000 0.504 0.618
## ht 0.192 0.044 4.343 0.000 0.192 0.242
## ha 0.091 0.062 1.474 0.141 0.091 0.100
## pb 0.068 0.103 0.662 0.508 0.068 0.042
## ps 0.898 0.100 9.013 0.000 0.898 0.567
## pt 0.182 0.093 1.945 0.052 0.182 0.122
## pa 0.350 0.112 3.132 0.002 0.350 0.188
## fb 0.485 0.138 3.520 0.000 0.485 0.223
## fs 1.370 0.151 9.097 0.000 1.370 0.601
## ft 0.054 0.156 0.345 0.730 0.054 0.023
## fa 0.512 0.149 3.439 0.001 0.512 0.204
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 32 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 29
##
## Used Total
## Number of observations 210 312
##
## Model Test User Model:
##
## Test statistic 2.719
## Degrees of freedom 4
## P-value (Chi-square) 0.606
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.031 0.035 0.885 0.376 0.031 0.057
## hzoop_1 (hs1) -0.260 0.037 -7.013 0.000 -0.260 -0.509
## pzoop_1 (ht1) 0.016 0.034 0.480 0.631 0.016 0.032
## potam_1 (ht2) -0.090 0.035 -2.545 0.011 -0.090 -0.171
## estfs__1 (ht3) 0.008 0.033 0.228 0.819 0.008 0.015
## flow (ha1) 0.073 0.037 2.000 0.046 0.073 0.140
## temp (ha2) -0.007 0.032 -0.232 0.817 -0.007 -0.015
## turbid (ha3) -0.098 0.036 -2.716 0.007 -0.098 -0.184
## pzoop_gr ~
## chla_1 (pb1) 0.178 0.054 3.333 0.001 0.178 0.211
## hzoop_1 (pb2) 0.074 0.056 1.332 0.183 0.074 0.094
## pzoop_1 (ps1) -0.416 0.050 -8.233 0.000 -0.416 -0.525
## potam_1 (pt1) -0.075 0.054 -1.382 0.167 -0.075 -0.091
## estfs__1 (pt2) 0.025 0.050 0.496 0.620 0.025 0.031
## flow (pa1) -0.084 0.055 -1.528 0.127 -0.084 -0.103
## temp (pa2) 0.145 0.048 3.014 0.003 0.145 0.188
## turbid (pa3) 0.067 0.054 1.237 0.216 0.067 0.081
## estfish_bsmt_gr ~
## hzoop_1 (fb1) 0.151 0.105 1.443 0.149 0.151 0.092
## pzoop_1 (fb2) -0.123 0.101 -1.217 0.224 -0.123 -0.074
## estfs__1 (fs1) -1.006 0.106 -9.452 0.000 -1.006 -0.605
## flow (fa1) -0.245 0.108 -2.260 0.024 -0.245 -0.145
## temp (fa2) 0.056 0.095 0.585 0.558 0.056 0.035
## turbid (fa3) 0.305 0.104 2.921 0.003 0.305 0.178
## sbss1__1 (ft1) 0.267 0.103 2.600 0.009 0.267 0.160
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.063 0.021 3.012 0.003 0.063 0.212
## .estfsh_bsmt_gr -0.119 0.042 -2.848 0.004 -0.119 -0.200
## .pzoop_gr ~~
## .estfsh_bsmt_gr -0.034 0.061 -0.557 0.578 -0.034 -0.038
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.199 0.019 10.247 0.000 0.199 0.776
## .pzoop_gr 0.444 0.043 10.247 0.000 0.444 0.722
## .estfsh_bsmt_gr 1.773 0.173 10.247 0.000 1.773 0.666
##
## R-Square:
## Estimate
## hzoop_gr 0.224
## pzoop_gr 0.278
## estfsh_bsmt_gr 0.334
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.031 0.035 0.885 0.376 0.031 0.057
## hs 0.260 0.037 7.013 0.000 0.260 0.509
## ht 0.092 0.035 2.651 0.008 0.092 0.174
## ha 0.122 0.040 3.056 0.002 0.122 0.231
## pb 0.193 0.048 3.991 0.000 0.193 0.231
## ps 0.416 0.050 8.233 0.000 0.416 0.525
## pt 0.079 0.052 1.518 0.129 0.079 0.096
## pa 0.180 0.054 3.323 0.001 0.180 0.229
## fb 0.195 0.118 1.654 0.098 0.195 0.118
## fs 1.006 0.106 9.452 0.000 1.006 0.605
## ft 0.267 0.103 2.600 0.009 0.267 0.160
## fa 0.395 0.120 3.290 0.001 0.395 0.232
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 28 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 31
##
## Used Total
## Number of observations 193 312
##
## Model Test User Model:
##
## Test statistic 9.014
## Degrees of freedom 8
## P-value (Chi-square) 0.341
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.040 0.053 0.748 0.455 0.040 0.043
## hzoop_1 (hs1) -0.536 0.052 -10.271 0.000 -0.536 -0.611
## pzoop_1 (ht1) -0.001 0.054 -0.027 0.979 -0.001 -0.002
## corbic_1 (ht2) 0.027 0.050 0.535 0.593 0.027 0.030
## estfs__1 (ht3) -0.057 0.050 -1.133 0.257 -0.057 -0.071
## flow (ha1) 0.130 0.056 2.315 0.021 0.130 0.150
## temp (ha2) 0.036 0.049 0.727 0.467 0.036 0.043
## turbid (ha3) 0.150 0.052 2.911 0.004 0.150 0.170
## pzoop_gr ~
## chla_1 (pb1) 0.387 0.100 3.879 0.000 0.387 0.221
## hzoop_1 (pb2) 0.194 0.097 2.007 0.045 0.194 0.118
## pzoop_1 (ps1) -1.032 0.100 -10.275 0.000 -1.032 -0.631
## corbic_1 (pt1) 0.087 0.094 0.931 0.352 0.087 0.053
## estfs__1 (pt2) -0.093 0.093 -0.997 0.319 -0.093 -0.062
## flow (pa1) -0.542 0.104 -5.224 0.000 -0.542 -0.336
## temp (pa2) 0.062 0.091 0.681 0.496 0.062 0.040
## turbid (pa3) 0.101 0.096 1.058 0.290 0.101 0.061
## estfish_bsmt_gr ~
## hzoop_1 (fb1) 0.330 0.178 1.856 0.063 0.330 0.124
## pzoop_1 (fb2) 0.084 0.179 0.470 0.638 0.084 0.032
## estfs__1 (fs1) -1.435 0.171 -8.379 0.000 -1.435 -0.588
## flow (fa1) -0.649 0.188 -3.452 0.001 -0.649 -0.248
## temp (fa2) 0.046 0.162 0.284 0.776 0.046 0.018
## turbid (fa3) 0.110 0.175 0.627 0.530 0.110 0.041
## sside_1 (ft1) -0.026 0.162 -0.161 0.872 -0.026 -0.010
## cent_1 (ft2) -0.264 0.165 -1.599 0.110 -0.264 -0.103
## sbss1__1 (ft3) 0.187 0.170 1.103 0.270 0.187 0.073
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.261 0.062 4.220 0.000 0.261 0.319
## .estfsh_bsmt_gr -0.203 0.106 -1.917 0.055 -0.203 -0.139
## .pzoop_gr ~~
## .estfsh_bsmt_gr 0.074 0.195 0.377 0.706 0.074 0.027
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.442 0.045 9.823 0.000 0.442 0.606
## .pzoop_gr 1.521 0.155 9.823 0.000 1.521 0.595
## .estfsh_bsmt_gr 4.818 0.490 9.823 0.000 4.818 0.717
##
## R-Square:
## Estimate
## hzoop_gr 0.394
## pzoop_gr 0.405
## estfsh_bsmt_gr 0.283
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.040 0.053 0.748 0.455 0.040 0.043
## hs 0.536 0.052 10.271 0.000 0.536 0.611
## ht 0.063 0.052 1.217 0.224 0.063 0.077
## ha 0.201 0.050 4.006 0.000 0.201 0.231
## pb 0.433 0.097 4.464 0.000 0.433 0.250
## ps 1.032 0.100 10.275 0.000 1.032 0.631
## pt 0.128 0.098 1.303 0.192 0.128 0.081
## pa 0.555 0.104 5.343 0.000 0.555 0.344
## fb 0.340 0.166 2.046 0.041 0.340 0.128
## fs 1.435 0.171 8.379 0.000 1.435 0.588
## ft 0.325 0.152 2.141 0.032 0.325 0.127
## fa 0.660 0.190 3.477 0.001 0.660 0.252
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 34 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
##
## Used Total
## Number of observations 199 312
##
## Model Test User Model:
##
## Test statistic 3.608
## Degrees of freedom 7
## P-value (Chi-square) 0.824
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hzoop_gr ~
## chla_1 (hb1) 0.139 0.047 2.974 0.003 0.139 0.182
## hzoop_1 (hs1) -0.410 0.045 -9.199 0.000 -0.410 -0.554
## pzoop_1 (ht1) -0.027 0.049 -0.557 0.578 -0.027 -0.035
## corbic_1 (ht2) 0.035 0.045 0.774 0.439 0.035 0.046
## estfs__1 (ht3) 0.005 0.045 0.111 0.911 0.005 0.007
## flow (ha1) 0.100 0.046 2.161 0.031 0.100 0.129
## temp (ha2) 0.050 0.043 1.156 0.248 0.050 0.069
## turbid (ha3) -0.044 0.044 -1.012 0.312 -0.044 -0.061
## pzoop_gr ~
## chla_1 (pb1) 0.339 0.077 4.429 0.000 0.339 0.267
## hzoop_1 (pb2) 0.121 0.073 1.654 0.098 0.121 0.098
## pzoop_1 (ps1) -0.769 0.080 -9.585 0.000 -0.769 -0.601
## corbic_1 (pt1) -0.017 0.073 -0.239 0.811 -0.017 -0.014
## estfs__1 (pt2) 0.035 0.073 0.484 0.628 0.035 0.030
## flow (pa1) -0.137 0.076 -1.809 0.070 -0.137 -0.106
## temp (pa2) -0.043 0.071 -0.604 0.546 -0.043 -0.036
## turbid (pa3) 0.105 0.072 1.467 0.142 0.105 0.087
## estfish_bsmt_gr ~
## chla_1 (fb1) 0.232 0.183 1.272 0.204 0.232 0.078
## hzoop_1 (fb2) 0.333 0.176 1.888 0.059 0.333 0.115
## pzoop_1 (fb3) -0.004 0.191 -0.020 0.984 -0.004 -0.001
## estfs__1 (fs1) -1.576 0.178 -8.874 0.000 -1.576 -0.561
## flow (fa1) -0.145 0.183 -0.791 0.429 -0.145 -0.048
## temp (fa2) -0.053 0.168 -0.316 0.752 -0.053 -0.019
## turbid (fa3) 0.462 0.185 2.491 0.013 0.462 0.162
## sside_1 (ft1) -0.027 0.166 -0.161 0.872 -0.027 -0.009
## cent_1 (ft2) -0.240 0.173 -1.390 0.165 -0.240 -0.087
## sbss1__1 (ft3) 0.143 0.176 0.815 0.415 0.143 0.051
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr ~~
## .pzoop_gr 0.176 0.043 4.108 0.000 0.176 0.304
## .estfsh_bsmt_gr -0.166 0.098 -1.693 0.090 -0.166 -0.121
## .pzoop_gr ~~
## .estfsh_bsmt_gr 0.384 0.162 2.374 0.018 0.384 0.171
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .hzoop_gr 0.353 0.035 9.975 0.000 0.353 0.680
## .pzoop_gr 0.948 0.095 9.975 0.000 0.948 0.657
## .estfsh_bsmt_gr 5.328 0.534 9.975 0.000 5.328 0.672
##
## R-Square:
## Estimate
## hzoop_gr 0.320
## pzoop_gr 0.343
## estfsh_bsmt_gr 0.328
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## hb 0.139 0.047 2.974 0.003 0.139 0.182
## hs 0.410 0.045 9.199 0.000 0.410 0.554
## ht 0.044 0.048 0.922 0.357 0.044 0.058
## ha 0.120 0.047 2.562 0.010 0.120 0.159
## pb 0.360 0.074 4.889 0.000 0.360 0.285
## ps 0.769 0.080 9.585 0.000 0.769 0.601
## pt 0.039 0.072 0.549 0.583 0.039 0.033
## pa 0.178 0.078 2.293 0.022 0.178 0.142
## fb 0.406 0.169 2.407 0.016 0.406 0.139
## fs 1.576 0.178 8.874 0.000 1.576 0.561
## ft 0.281 0.183 1.531 0.126 0.281 0.101
## fa 0.487 0.195 2.501 0.012 0.487 0.170
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitS)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
upper_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="Far West",
manual_port_settings=TRUE)
upper_plot_far_west
#WEST
upper_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="West",
manual_port_settings=TRUE)
upper_plot_west
#NORTH
upper_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="North",
manual_port_settings=TRUE)
upper_plot_north
#SOUTH
upper_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_upper_trophic",
title="South",
manual_port_settings=TRUE)
upper_plot_south
modFW='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modW='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*potam_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*potam_1+ca1*flow+ca2*temp+ca3*turbid
potam~lb1*din_1+lb2*chla_1+lb3*hzoop_1+lb4*pzoop_1+ls1*potam_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2+lb4^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modN='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ct3*pzoop_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2+ct3^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modS='din_gr~ns1*din_1+nt1*chla_gr+nn1*hzoop_1+nn2*pzoop_1+nn3*corbic_1+na1*flow+na2*temp+na3*turbid
chla_gr~cb1*din_1+cs1*chla_1+ct1*hzoop_1+ct2*corbic_1+ca1*flow+ca2*temp+ca3*turbid
corbic~lb1*chla_1+lb2*hzoop_1+lb3*pzoop_1+ls1*corbic_1+la1*flow+la2*temp+la3*turbid
ns:=sqrt(ns1^2)
nt:=sqrt(nt1^2)
nn:=sqrt(nn1^2+nn2^2+nn3^2)
na:=sqrt(na1^2+na2^2+na3^2)
cb:=sqrt(cb1^2)
cs:=sqrt(cs1^2)
ct:=sqrt(ct1^2+ct2^2)
ca:=sqrt(ca1^2+ca2^2+ca3^2)
lb:=sqrt(lb1^2+lb2^2+lb3^2)
ls:=sqrt(ls1^2)
la:=sqrt(la1^2+la2^2+la3^2)
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 20 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 234 312
##
## Model Test User Model:
##
## Test statistic 5.259
## Degrees of freedom 4
## P-value (Chi-square) 0.262
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.218 0.025 -8.695 0.000 -0.218 -0.487
## chla_gr (nt1) -0.160 0.051 -3.132 0.002 -0.160 -0.175
## hzoop_1 (nn1) 0.000 0.026 0.009 0.993 0.000 0.001
## pzoop_1 (nn2) -0.010 0.025 -0.404 0.686 -0.010 -0.023
## potam_1 (nn3) -0.001 0.025 -0.059 0.953 -0.001 -0.003
## flow (na1) 0.003 0.029 0.114 0.909 0.003 0.007
## temp (na2) -0.046 0.028 -1.652 0.099 -0.046 -0.099
## turbid (na3) -0.054 0.029 -1.840 0.066 -0.054 -0.114
## chla_gr ~
## din_1 (cb1) 0.000 0.027 0.001 0.999 0.000 0.000
## chla_1 (cs1) -0.323 0.034 -9.624 0.000 -0.323 -0.538
## hzoop_1 (ct1) -0.001 0.028 -0.047 0.963 -0.001 -0.003
## potam_1 (ct2) -0.014 0.027 -0.540 0.589 -0.014 -0.030
## flow (ca1) 0.014 0.031 0.462 0.644 0.014 0.028
## temp (ca2) 0.044 0.030 1.466 0.143 0.044 0.086
## turbid (ca3) -0.025 0.032 -0.789 0.430 -0.025 -0.048
## potam ~
## chla_1 (lb1) 0.058 0.060 0.962 0.336 0.058 0.046
## hzoop_1 (lb2) -0.079 0.051 -1.543 0.123 -0.079 -0.076
## pzoop_1 (lb3) -0.162 0.050 -3.251 0.001 -0.162 -0.160
## potam_1 (ls1) 0.628 0.048 13.006 0.000 0.628 0.629
## flow (la1) 0.112 0.057 1.962 0.050 0.112 0.102
## temp (la2) -0.043 0.054 -0.801 0.423 -0.043 -0.040
## turbid (la3) 0.038 0.058 0.647 0.517 0.038 0.034
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .potam -0.017 0.019 -0.910 0.363 -0.017 -0.060
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.147 0.014 10.817 0.000 0.147 0.708
## .chla_gr 0.172 0.016 10.817 0.000 0.172 0.694
## .potam 0.567 0.052 10.817 0.000 0.567 0.517
##
## R-Square:
## Estimate
## din_gr 0.292
## chla_gr 0.306
## potam 0.483
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.218 0.025 8.695 0.000 0.218 0.487
## nt 0.160 0.051 3.132 0.002 0.160 0.175
## nn 0.010 0.026 0.406 0.685 0.010 0.024
## na 0.071 0.032 2.212 0.027 0.071 0.151
## cb 0.000 0.027 0.001 0.999 0.000 0.000
## cs 0.323 0.034 9.624 0.000 0.323 0.538
## ct 0.014 0.027 0.532 0.595 0.014 0.030
## ca 0.053 0.029 1.789 0.074 0.053 0.102
## lb 0.189 0.049 3.863 0.000 0.189 0.183
## ls 0.628 0.048 13.006 0.000 0.628 0.629
## la 0.126 0.049 2.582 0.010 0.126 0.115
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 25 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 257 312
##
## Model Test User Model:
##
## Test statistic 17.574
## Degrees of freedom 3
## P-value (Chi-square) 0.001
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.196 0.020 -9.636 0.000 -0.196 -0.566
## chla_gr (nt1) -0.122 0.033 -3.698 0.000 -0.122 -0.191
## hzoop_1 (nn1) -0.009 0.020 -0.464 0.643 -0.009 -0.028
## pzoop_1 (nn2) 0.008 0.019 0.432 0.665 0.008 0.024
## potam_1 (nn3) 0.021 0.021 1.020 0.308 0.021 0.062
## flow (na1) -0.122 0.021 -5.722 0.000 -0.122 -0.344
## temp (na2) 0.020 0.018 1.087 0.277 0.020 0.058
## turbid (na3) 0.040 0.020 2.010 0.044 0.040 0.115
## chla_gr ~
## din_1 (cb1) -0.064 0.032 -1.967 0.049 -0.064 -0.118
## chla_1 (cs1) -0.370 0.034 -11.038 0.000 -0.370 -0.618
## hzoop_1 (ct1) 0.049 0.030 1.612 0.107 0.049 0.093
## potam_1 (ct2) 0.013 0.032 0.396 0.692 0.013 0.024
## flow (ca1) 0.001 0.033 0.044 0.965 0.001 0.003
## temp (ca2) -0.042 0.028 -1.458 0.145 -0.042 -0.078
## turbid (ca3) -0.014 0.031 -0.450 0.653 -0.014 -0.026
## potam ~
## din_1 (lb1) 0.075 0.044 1.712 0.087 0.075 0.074
## chla_1 (lb2) 0.001 0.045 0.015 0.988 0.001 0.001
## hzoop_1 (lb3) -0.032 0.043 -0.752 0.452 -0.032 -0.033
## pzoop_1 (lb4) 0.077 0.040 1.927 0.054 0.077 0.077
## potam_1 (ls1) 0.702 0.044 15.987 0.000 0.702 0.697
## flow (la1) -0.108 0.045 -2.405 0.016 -0.108 -0.104
## temp (la2) -0.010 0.039 -0.262 0.793 -0.010 -0.010
## turbid (la3) -0.079 0.042 -1.890 0.059 -0.079 -0.078
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .potam 0.013 0.011 1.221 0.222 0.013 0.076
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.081 0.007 11.336 0.000 0.081 0.681
## .chla_gr 0.195 0.017 11.336 0.000 0.195 0.673
## .potam 0.358 0.032 11.336 0.000 0.358 0.351
##
## R-Square:
## Estimate
## din_gr 0.319
## chla_gr 0.327
## potam 0.649
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.196 0.020 9.636 0.000 0.196 0.566
## nt 0.122 0.033 3.698 0.000 0.122 0.191
## nn 0.025 0.021 1.194 0.232 0.025 0.072
## na 0.130 0.022 5.860 0.000 0.130 0.367
## cb 0.064 0.032 1.967 0.049 0.064 0.118
## cs 0.370 0.034 11.038 0.000 0.370 0.618
## ct 0.050 0.032 1.573 0.116 0.050 0.096
## ca 0.044 0.030 1.444 0.149 0.044 0.082
## lb 0.113 0.044 2.583 0.010 0.113 0.112
## ls 0.702 0.044 15.987 0.000 0.702 0.697
## la 0.134 0.040 3.330 0.001 0.134 0.130
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 19 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 27
##
## Used Total
## Number of observations 255 312
##
## Model Test User Model:
##
## Test statistic 23.281
## Degrees of freedom 3
## P-value (Chi-square) 0.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.336 0.026 -13.176 0.000 -0.336 -0.679
## chla_gr (nt1) -0.108 0.033 -3.258 0.001 -0.108 -0.155
## hzoop_1 (nn1) 0.012 0.025 0.503 0.615 0.012 0.025
## pzoop_1 (nn2) 0.057 0.026 2.203 0.028 0.057 0.113
## corbic_1 (nn3) -0.010 0.024 -0.407 0.684 -0.010 -0.019
## flow (na1) -0.176 0.027 -6.474 0.000 -0.176 -0.344
## temp (na2) 0.020 0.024 0.842 0.400 0.020 0.041
## turbid (na3) 0.016 0.023 0.692 0.489 0.016 0.033
## chla_gr ~
## din_1 (cb1) 0.012 0.040 0.306 0.760 0.012 0.017
## chla_1 (cs1) -0.398 0.037 -10.808 0.000 -0.398 -0.561
## hzoop_1 (ct1) -0.016 0.038 -0.411 0.681 -0.016 -0.022
## corbic_1 (ct2) 0.013 0.038 0.350 0.727 0.013 0.018
## pzoop_1 (ct3) -0.087 0.040 -2.153 0.031 -0.087 -0.119
## flow (ca1) -0.048 0.042 -1.137 0.256 -0.048 -0.066
## temp (ca2) 0.058 0.038 1.555 0.120 0.058 0.082
## turbid (ca3) 0.046 0.036 1.276 0.202 0.046 0.066
## corbic ~
## chla_1 (lb1) -0.001 0.053 -0.021 0.983 -0.001 -0.001
## hzoop_1 (lb2) 0.015 0.056 0.264 0.792 0.015 0.015
## pzoop_1 (lb3) -0.011 0.058 -0.191 0.849 -0.011 -0.011
## corbic_1 (ls1) 0.463 0.056 8.308 0.000 0.463 0.460
## flow (la1) 0.092 0.060 1.538 0.124 0.092 0.091
## temp (la2) -0.034 0.055 -0.615 0.539 -0.034 -0.035
## turbid (la3) -0.117 0.053 -2.208 0.027 -0.117 -0.121
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .corbic -0.010 0.019 -0.506 0.613 -0.010 -0.032
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.135 0.012 11.292 0.000 0.135 0.547
## .chla_gr 0.331 0.029 11.292 0.000 0.331 0.647
## .corbic 0.715 0.063 11.292 0.000 0.715 0.740
##
## R-Square:
## Estimate
## din_gr 0.453
## chla_gr 0.353
## corbic 0.260
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.336 0.026 13.176 0.000 0.336 0.679
## nt 0.108 0.033 3.258 0.001 0.108 0.155
## nn 0.059 0.024 2.423 0.015 0.059 0.117
## na 0.177 0.027 6.594 0.000 0.177 0.348
## cb 0.012 0.040 0.306 0.760 0.012 0.017
## cs 0.398 0.037 10.808 0.000 0.398 0.561
## ct 0.089 0.038 2.330 0.020 0.089 0.122
## ca 0.089 0.038 2.328 0.020 0.089 0.124
## lb 0.019 0.062 0.299 0.765 0.019 0.019
## ls 0.463 0.056 8.308 0.000 0.463 0.460
## la 0.152 0.057 2.684 0.007 0.152 0.155
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 19 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 26
##
## Used Total
## Number of observations 256 312
##
## Model Test User Model:
##
## Test statistic 2.520
## Degrees of freedom 4
## P-value (Chi-square) 0.641
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## din_gr ~
## din_1 (ns1) -0.297 0.028 -10.573 0.000 -0.297 -0.577
## chla_gr (nt1) -0.100 0.035 -2.890 0.004 -0.100 -0.148
## hzoop_1 (nn1) -0.013 0.029 -0.433 0.665 -0.013 -0.023
## pzoop_1 (nn2) -0.011 0.030 -0.361 0.718 -0.011 -0.019
## corbic_1 (nn3) 0.038 0.027 1.372 0.170 0.038 0.073
## flow (na1) -0.008 0.028 -0.278 0.781 -0.008 -0.014
## temp (na2) 0.045 0.027 1.657 0.097 0.045 0.086
## turbid (na3) 0.092 0.029 3.185 0.001 0.092 0.176
## chla_gr ~
## din_1 (cb1) -0.017 0.042 -0.402 0.688 -0.017 -0.022
## chla_1 (cs1) -0.441 0.042 -10.587 0.000 -0.441 -0.566
## hzoop_1 (ct1) 0.060 0.044 1.354 0.176 0.060 0.074
## corbic_1 (ct2) 0.048 0.041 1.169 0.242 0.048 0.063
## flow (ca1) -0.076 0.042 -1.809 0.070 -0.076 -0.096
## temp (ca2) 0.008 0.041 0.189 0.850 0.008 0.010
## turbid (ca3) 0.014 0.044 0.317 0.751 0.014 0.018
## corbic ~
## chla_1 (lb1) 0.047 0.059 0.789 0.430 0.047 0.046
## hzoop_1 (lb2) -0.029 0.061 -0.474 0.635 -0.029 -0.028
## pzoop_1 (lb3) -0.039 0.063 -0.627 0.531 -0.039 -0.037
## corbic_1 (ls1) 0.316 0.058 5.483 0.000 0.316 0.319
## flow (la1) 0.082 0.058 1.397 0.162 0.082 0.080
## temp (la2) -0.078 0.058 -1.347 0.178 -0.078 -0.077
## turbid (la3) 0.185 0.058 3.209 0.001 0.185 0.186
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr ~~
## .corbic -0.024 0.024 -0.981 0.327 -0.024 -0.061
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .din_gr 0.182 0.016 11.314 0.000 0.182 0.663
## .chla_gr 0.415 0.037 11.314 0.000 0.415 0.688
## .corbic 0.812 0.072 11.314 0.000 0.812 0.809
##
## R-Square:
## Estimate
## din_gr 0.337
## chla_gr 0.312
## corbic 0.191
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ns 0.297 0.028 10.573 0.000 0.297 0.577
## nt 0.100 0.035 2.890 0.004 0.100 0.148
## nn 0.041 0.028 1.466 0.143 0.041 0.079
## na 0.102 0.029 3.501 0.000 0.102 0.196
## cb 0.017 0.042 0.402 0.688 0.017 0.022
## cs 0.441 0.042 10.587 0.000 0.441 0.566
## ct 0.077 0.041 1.868 0.062 0.077 0.097
## ca 0.077 0.042 1.818 0.069 0.077 0.098
## lb 0.068 0.066 1.029 0.303 0.068 0.066
## ls 0.316 0.058 5.483 0.000 0.316 0.319
## la 0.217 0.055 3.923 0.000 0.217 0.217
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
lower_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="Far West",
manual_port_settings=TRUE)
lower_plot_far_west
#WEST
lower_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="West",
manual_port_settings=TRUE)
lower_plot_west
#NORTH
lower_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="North",
manual_port_settings=TRUE)
lower_plot_north
#SOUTH
lower_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_lower_trophic",
title="South",
manual_port_settings=TRUE)
lower_plot_south
modFW='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+potam_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+flow+turbid+temp
'
modW='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+potam_1+flow+turbid+temp+mysid_1
hcope_gr~chla_1+hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
amphi_m_gr~chla_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+mysid_1+potam_1+flow+turbid+temp+estfish_bsmt_1+rotif_m_1
mysid_gr~chla_1+hcope_1+pcope_1+amphi_m_1+mysid_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modN='chla_gr~chla_1+hcope_1+amphi_m_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~hcope_1+pcope_1+mysid_1+corbic_1+flow+turbid+temp+estfish_bsmt_1+chla_1
mysid_gr~hcope_1+pcope_1+mysid_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+mysid_1+flow+turbid+temp
'
modS='chla_gr~chla_1+hcope_1+clad_1+rotif_m_1+corbic_1+flow+turbid+temp
hcope_gr~chla_1+hcope_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
clad_gr~chla_1+clad_1+pcope_1+flow+turbid+temp+estfish_bsmt_1
amphi_m_gr~chla_1+amphi_m_1+flow+turbid+temp+estfish_bsmt_1
rotif_m_gr~chla_1+rotif_m_1+flow+turbid+temp+estfish_bsmt_1
pcope_gr~chla_1+hcope_1+clad_1+pcope_1+corbic_1+flow+turbid+temp+estfish_bsmt_1
estfish_bsmt_gr~estfish_bsmt_1+hcope_1+pcope_1+amphi_m_1+rotif_m_1+clad_1+flow+turbid+temp
'
modfitFW=sem(modFW, data=filter(fdr_ds,region=="Far West"))
modfitW=sem(modW, data=filter(fdr_ds,region=="West"))
modfitN=sem(modN, data=filter(fdr_ds,region=="North"))
modfitS=sem(modS, data=filter(fdr_ds,region=="South"))
summary(modfitFW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 48 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 64
##
## Used Total
## Number of observations 183 312
##
## Model Test User Model:
##
## Test statistic 26.025
## Degrees of freedom 17
## P-value (Chi-square) 0.074
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.338 0.037 -9.194 0.000 -0.338 -0.564
## hcope_1 0.047 0.030 1.558 0.119 0.047 0.096
## amphi_m_1 0.006 0.036 0.177 0.860 0.006 0.013
## rotif_m_1 -0.046 0.034 -1.347 0.178 -0.046 -0.087
## potam_1 -0.010 0.027 -0.357 0.721 -0.010 -0.022
## flow 0.031 0.039 0.788 0.430 0.031 0.060
## turbid -0.039 0.039 -0.993 0.321 -0.039 -0.070
## temp 0.028 0.034 0.826 0.409 0.028 0.053
## hcope_gr ~
## chla_1 0.147 0.080 1.840 0.066 0.147 0.103
## hcope_1 -0.723 0.070 -10.400 0.000 -0.723 -0.628
## pcope_1 0.065 0.072 0.902 0.367 0.065 0.054
## potam_1 -0.114 0.061 -1.848 0.065 -0.114 -0.108
## flow -0.074 0.081 -0.913 0.361 -0.074 -0.060
## turbid -0.047 0.085 -0.556 0.578 -0.047 -0.036
## temp -0.047 0.077 -0.612 0.540 -0.047 -0.037
## estfish_bsmt_1 -0.137 0.077 -1.786 0.074 -0.137 -0.114
## amphi_m_gr ~
## chla_1 0.071 0.083 0.859 0.390 0.071 0.056
## amphi_m_1 -0.532 0.079 -6.688 0.000 -0.532 -0.520
## flow -0.510 0.089 -5.740 0.000 -0.510 -0.467
## turbid 0.004 0.086 0.043 0.966 0.004 0.003
## temp 0.063 0.077 0.823 0.411 0.063 0.057
## estfish_bsmt_1 0.096 0.074 1.296 0.195 0.096 0.090
## rotif_m_gr ~
## chla_1 -0.414 0.174 -2.379 0.017 -0.414 -0.145
## rotif_m_1 -1.389 0.154 -9.043 0.000 -1.389 -0.549
## flow 0.086 0.172 0.499 0.618 0.086 0.035
## turbid 0.138 0.182 0.758 0.449 0.138 0.052
## temp -0.027 0.163 -0.169 0.866 -0.027 -0.011
## estfish_bsmt_1 -0.046 0.154 -0.299 0.765 -0.046 -0.019
## pcope_gr ~
## hcope_1 0.137 0.134 1.023 0.306 0.137 0.064
## pcope_1 -1.288 0.138 -9.324 0.000 -1.288 -0.579
## potam_1 -0.198 0.117 -1.688 0.091 -0.198 -0.102
## flow 0.357 0.156 2.294 0.022 0.357 0.157
## turbid 0.206 0.164 1.254 0.210 0.206 0.084
## temp 0.240 0.148 1.621 0.105 0.240 0.103
## estfish_bsmt_1 -0.027 0.147 -0.185 0.853 -0.027 -0.012
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.325 0.150 -8.810 0.000 -1.325 -0.589
## hcope_1 -0.208 0.136 -1.530 0.126 -0.208 -0.097
## pcope_1 0.331 0.141 2.352 0.019 0.331 0.147
## amphi_m_1 -0.142 0.160 -0.890 0.374 -0.142 -0.066
## rotif_m_1 -0.320 0.147 -2.182 0.029 -0.320 -0.136
## flow 0.141 0.172 0.821 0.412 0.141 0.061
## turbid 0.450 0.169 2.665 0.008 0.450 0.182
## temp -0.089 0.151 -0.591 0.555 -0.089 -0.038
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.022 0.029 0.755 0.450 0.022 0.056
## .amphi_m_gr -0.003 0.029 -0.120 0.904 -0.003 -0.009
## .rotif_m_gr 0.161 0.063 2.574 0.010 0.161 0.194
## .pcope_gr 0.044 0.056 0.792 0.428 0.044 0.059
## .estfsh_bsmt_gr -0.058 0.056 -1.022 0.307 -0.058 -0.076
## .hcope_gr ~~
## .amphi_m_gr -0.033 0.065 -0.513 0.608 -0.033 -0.038
## .rotif_m_gr 0.167 0.138 1.205 0.228 0.167 0.089
## .pcope_gr -0.371 0.127 -2.915 0.004 -0.371 -0.221
## .estfsh_bsmt_gr -0.095 0.126 -0.753 0.452 -0.095 -0.056
## .amphi_m_gr ~~
## .rotif_m_gr -0.259 0.139 -1.863 0.062 -0.259 -0.139
## .pcope_gr 0.019 0.125 0.152 0.879 0.019 0.011
## .estfsh_bsmt_gr -0.004 0.126 -0.034 0.973 -0.004 -0.002
## .rotif_m_gr ~~
## .pcope_gr -0.230 0.266 -0.865 0.387 -0.230 -0.064
## .estfsh_bsmt_gr -0.275 0.269 -1.023 0.306 -0.275 -0.076
## .pcope_gr ~~
## .estfsh_bsmt_gr -0.522 0.245 -2.129 0.033 -0.522 -0.159
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.174 0.018 9.566 0.000 0.174 0.674
## .hcope_gr 0.873 0.091 9.566 0.000 0.873 0.595
## .amphi_m_gr 0.875 0.091 9.566 0.000 0.875 0.755
## .rotif_m_gr 3.973 0.415 9.566 0.000 3.973 0.670
## .pcope_gr 3.243 0.339 9.566 0.000 3.243 0.645
## .estfsh_bsmt_gr 3.311 0.346 9.566 0.000 3.311 0.643
##
## R-Square:
## Estimate
## chla_gr 0.326
## hcope_gr 0.405
## amphi_m_gr 0.245
## rotif_m_gr 0.330
## pcope_gr 0.355
## estfsh_bsmt_gr 0.357
summary(modfitW, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 45 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 87
##
## Used Total
## Number of observations 202 312
##
## Model Test User Model:
##
## Test statistic 18.548
## Degrees of freedom 18
## P-value (Chi-square) 0.420
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.348 0.037 -9.389 0.000 -0.348 -0.595
## hcope_1 0.046 0.036 1.265 0.206 0.046 0.081
## amphi_m_1 0.047 0.035 1.320 0.187 0.047 0.087
## rotif_m_1 0.063 0.033 1.891 0.059 0.063 0.123
## potam_1 -0.021 0.037 -0.568 0.570 -0.021 -0.038
## flow -0.010 0.037 -0.256 0.798 -0.010 -0.017
## turbid 0.017 0.038 0.441 0.659 0.017 0.030
## temp -0.063 0.033 -1.930 0.054 -0.063 -0.118
## mysid_1 -0.040 0.036 -1.093 0.274 -0.040 -0.071
## hcope_gr ~
## chla_1 0.045 0.039 1.162 0.245 0.045 0.070
## hcope_1 -0.363 0.039 -9.230 0.000 -0.363 -0.577
## pcope_1 -0.053 0.034 -1.532 0.126 -0.053 -0.090
## mysid_1 0.038 0.040 0.939 0.348 0.038 0.061
## potam_1 -0.092 0.037 -2.500 0.012 -0.092 -0.150
## flow -0.088 0.040 -2.183 0.029 -0.088 -0.142
## turbid -0.040 0.041 -0.975 0.329 -0.040 -0.065
## temp 0.036 0.035 1.025 0.305 0.036 0.062
## estfish_bsmt_1 0.026 0.036 0.723 0.469 0.026 0.043
## rotif_m_1 0.116 0.034 3.452 0.001 0.116 0.203
## amphi_m_gr ~
## chla_1 -0.080 0.064 -1.246 0.213 -0.080 -0.083
## amphi_m_1 -0.315 0.061 -5.195 0.000 -0.315 -0.359
## mysid_1 0.152 0.061 2.491 0.013 0.152 0.166
## flow 0.003 0.063 0.051 0.959 0.003 0.003
## turbid -0.213 0.066 -3.226 0.001 -0.213 -0.230
## temp -0.162 0.058 -2.809 0.005 -0.162 -0.186
## estfish_bsmt_1 -0.256 0.061 -4.174 0.000 -0.256 -0.285
## rotif_m_gr ~
## chla_1 0.013 0.113 0.119 0.905 0.013 0.008
## rotif_m_1 -0.799 0.101 -7.939 0.000 -0.799 -0.511
## flow 0.307 0.114 2.683 0.007 0.307 0.181
## turbid -0.337 0.114 -2.956 0.003 -0.337 -0.197
## temp -0.033 0.103 -0.326 0.745 -0.033 -0.021
## estfish_bsmt_1 -0.264 0.104 -2.555 0.011 -0.264 -0.160
## pcope_gr ~
## hcope_1 -0.160 0.061 -2.618 0.009 -0.160 -0.169
## pcope_1 -0.466 0.057 -8.213 0.000 -0.466 -0.526
## mysid_1 0.143 0.064 2.247 0.025 0.143 0.154
## potam_1 0.021 0.063 0.338 0.736 0.021 0.023
## flow 0.125 0.063 1.977 0.048 0.125 0.134
## turbid -0.074 0.065 -1.138 0.255 -0.074 -0.079
## temp 0.178 0.055 3.229 0.001 0.178 0.200
## estfish_bsmt_1 0.004 0.058 0.076 0.939 0.004 0.005
## rotif_m_1 0.114 0.056 2.046 0.041 0.114 0.132
## mysid_gr ~
## chla_1 0.270 0.084 3.217 0.001 0.270 0.206
## hcope_1 0.078 0.082 0.951 0.342 0.078 0.061
## pcope_1 0.126 0.074 1.717 0.086 0.126 0.106
## amphi_m_1 -0.100 0.076 -1.318 0.188 -0.100 -0.084
## mysid_1 -0.696 0.086 -8.140 0.000 -0.696 -0.556
## flow -0.209 0.081 -2.573 0.010 -0.209 -0.167
## turbid 0.333 0.087 3.822 0.000 0.333 0.264
## temp 0.118 0.075 1.565 0.118 0.118 0.099
## estfish_bsmt_1 0.015 0.078 0.188 0.851 0.015 0.012
## estfish_bsmt_gr ~
## estfish_bsmt_1 -0.977 0.104 -9.417 0.000 -0.977 -0.589
## hcope_1 0.098 0.107 0.919 0.358 0.098 0.057
## pcope_1 -0.006 0.100 -0.063 0.950 -0.006 -0.004
## amphi_m_1 -0.267 0.107 -2.485 0.013 -0.267 -0.164
## rotif_m_1 -0.043 0.102 -0.419 0.675 -0.043 -0.027
## mysid_1 -0.151 0.112 -1.350 0.177 -0.151 -0.089
## flow -0.211 0.108 -1.953 0.051 -0.211 -0.124
## turbid 0.252 0.114 2.207 0.027 0.252 0.148
## temp 0.067 0.097 0.689 0.491 0.067 0.041
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.057 0.016 3.579 0.000 0.057 0.260
## .amphi_m_gr 0.000 0.025 0.008 0.994 0.000 0.001
## .rotif_m_gr 0.080 0.045 1.771 0.077 0.080 0.126
## .pcope_gr -0.012 0.024 -0.483 0.629 -0.012 -0.034
## .mysid_gr 0.076 0.033 2.312 0.021 0.076 0.165
## .estfsh_bsmt_gr -0.027 0.042 -0.630 0.529 -0.027 -0.044
## .hcope_gr ~~
## .amphi_m_gr -0.055 0.027 -2.009 0.045 -0.055 -0.143
## .rotif_m_gr -0.043 0.049 -0.881 0.378 -0.043 -0.062
## .pcope_gr 0.027 0.026 1.037 0.300 0.027 0.073
## .mysid_gr 0.176 0.037 4.728 0.000 0.176 0.353
## .estfsh_bsmt_gr -0.116 0.047 -2.486 0.013 -0.116 -0.178
## .amphi_m_gr ~~
## .rotif_m_gr 0.214 0.081 2.632 0.008 0.214 0.188
## .pcope_gr -0.001 0.043 -0.018 0.986 -0.001 -0.001
## .mysid_gr -0.111 0.058 -1.910 0.056 -0.111 -0.136
## .estfsh_bsmt_gr 0.046 0.075 0.605 0.545 0.046 0.043
## .rotif_m_gr ~~
## .pcope_gr -0.103 0.077 -1.343 0.179 -0.103 -0.095
## .mysid_gr -0.148 0.104 -1.433 0.152 -0.148 -0.101
## .estfsh_bsmt_gr 0.140 0.135 1.038 0.299 0.140 0.073
## .pcope_gr ~~
## .mysid_gr -0.043 0.055 -0.771 0.440 -0.043 -0.054
## .estfsh_bsmt_gr -0.011 0.072 -0.150 0.881 -0.011 -0.011
## .mysid_gr ~~
## .estfsh_bsmt_gr -0.068 0.097 -0.697 0.486 -0.068 -0.049
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.201 0.020 10.050 0.000 0.201 0.683
## .hcope_gr 0.235 0.023 10.050 0.000 0.235 0.650
## .amphi_m_gr 0.633 0.063 10.050 0.000 0.633 0.795
## .rotif_m_gr 2.029 0.202 10.050 0.000 2.029 0.746
## .pcope_gr 0.582 0.058 10.050 0.000 0.582 0.709
## .mysid_gr 1.056 0.105 10.050 0.000 1.056 0.714
## .estfsh_bsmt_gr 1.802 0.179 10.050 0.000 1.802 0.663
##
## R-Square:
## Estimate
## chla_gr 0.317
## hcope_gr 0.350
## amphi_m_gr 0.205
## rotif_m_gr 0.254
## pcope_gr 0.291
## mysid_gr 0.286
## estfsh_bsmt_gr 0.337
summary(modfitN, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 59 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 83
##
## Used Total
## Number of observations 186 312
##
## Model Test User Model:
##
## Test statistic 33.385
## Degrees of freedom 22
## P-value (Chi-square) 0.057
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.408 0.047 -8.742 0.000 -0.408 -0.543
## hcope_1 0.050 0.059 0.842 0.400 0.050 0.058
## amphi_m_1 0.020 0.044 0.457 0.647 0.020 0.027
## rotif_m_1 0.029 0.044 0.671 0.502 0.029 0.043
## corbic_1 -0.018 0.044 -0.402 0.688 -0.018 -0.025
## flow -0.019 0.047 -0.391 0.696 -0.019 -0.027
## turbid 0.030 0.044 0.675 0.500 0.030 0.044
## temp 0.044 0.043 1.023 0.306 0.044 0.066
## hcope_gr ~
## chla_1 0.001 0.062 0.022 0.983 0.001 0.001
## hcope_1 -0.820 0.099 -8.282 0.000 -0.820 -0.613
## pcope_1 -0.096 0.061 -1.573 0.116 -0.096 -0.094
## mysid_1 0.026 0.082 0.312 0.755 0.026 0.023
## corbic_1 0.152 0.057 2.686 0.007 0.152 0.139
## flow -0.398 0.072 -5.514 0.000 -0.398 -0.371
## turbid 0.146 0.069 2.108 0.035 0.146 0.138
## temp 0.023 0.065 0.348 0.728 0.023 0.022
## estfish_bsmt_1 0.005 0.065 0.073 0.942 0.005 0.005
## amphi_m_gr ~
## chla_1 0.064 0.072 0.891 0.373 0.064 0.058
## amphi_m_1 -0.485 0.069 -6.991 0.000 -0.485 -0.440
## flow 0.004 0.073 0.051 0.960 0.004 0.004
## turbid -0.062 0.068 -0.913 0.361 -0.062 -0.062
## temp -0.033 0.066 -0.498 0.619 -0.033 -0.033
## estfish_bsmt_1 -0.060 0.067 -0.901 0.368 -0.060 -0.064
## rotif_m_gr ~
## chla_1 -0.222 0.135 -1.644 0.100 -0.222 -0.089
## rotif_m_1 -1.501 0.127 -11.846 0.000 -1.501 -0.660
## flow 0.861 0.142 6.070 0.000 0.861 0.379
## turbid -0.207 0.130 -1.596 0.111 -0.207 -0.092
## temp -0.027 0.127 -0.212 0.832 -0.027 -0.012
## estfish_bsmt_1 0.031 0.128 0.244 0.807 0.031 0.015
## pcope_gr ~
## hcope_1 -0.071 0.168 -0.422 0.673 -0.071 -0.032
## pcope_1 -1.006 0.106 -9.512 0.000 -1.006 -0.589
## mysid_1 0.180 0.142 1.261 0.207 0.180 0.097
## corbic_1 0.074 0.103 0.719 0.472 0.074 0.040
## flow -0.274 0.121 -2.268 0.023 -0.274 -0.153
## turbid -0.279 0.116 -2.401 0.016 -0.279 -0.157
## temp 0.042 0.109 0.387 0.699 0.042 0.024
## estfish_bsmt_1 -0.178 0.110 -1.616 0.106 -0.178 -0.107
## chla_1 0.277 0.114 2.439 0.015 0.277 0.141
## mysid_gr ~
## hcope_1 0.038 0.302 0.126 0.900 0.038 0.009
## pcope_1 -0.081 0.190 -0.425 0.671 -0.081 -0.025
## mysid_1 -2.461 0.254 -9.693 0.000 -2.461 -0.710
## amphi_m_1 -0.291 0.182 -1.597 0.110 -0.291 -0.079
## flow -1.170 0.216 -5.420 0.000 -1.170 -0.346
## turbid 0.861 0.207 4.148 0.000 0.861 0.258
## temp 0.157 0.191 0.818 0.413 0.157 0.048
## estfish_bsmt_1 0.111 0.199 0.559 0.577 0.111 0.035
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.390 0.175 -7.925 0.000 -1.390 -0.567
## hcope_1 0.189 0.274 0.690 0.490 0.189 0.057
## pcope_1 -0.157 0.173 -0.910 0.363 -0.157 -0.063
## amphi_m_1 -0.098 0.182 -0.537 0.591 -0.098 -0.034
## rotif_m_1 0.168 0.178 0.943 0.346 0.168 0.064
## mysid_1 0.322 0.230 1.402 0.161 0.322 0.119
## flow -0.500 0.193 -2.597 0.009 -0.500 -0.190
## turbid 0.115 0.183 0.625 0.532 0.115 0.044
## temp -0.023 0.169 -0.136 0.892 -0.023 -0.009
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.113 0.037 3.043 0.002 0.113 0.229
## .amphi_m_gr 0.047 0.038 1.256 0.209 0.047 0.092
## .rotif_m_gr 0.104 0.072 1.433 0.152 0.104 0.106
## .pcope_gr -0.116 0.061 -1.904 0.057 -0.116 -0.141
## .mysid_gr 0.089 0.108 0.826 0.409 0.089 0.061
## .estfsh_bsmt_gr -0.114 0.095 -1.201 0.230 -0.114 -0.088
## .hcope_gr ~~
## .amphi_m_gr 0.043 0.056 0.756 0.450 0.043 0.056
## .rotif_m_gr -0.438 0.112 -3.891 0.000 -0.438 -0.298
## .pcope_gr 0.338 0.094 3.613 0.000 0.338 0.275
## .mysid_gr 1.063 0.179 5.942 0.000 1.063 0.484
## .estfsh_bsmt_gr -0.159 0.142 -1.121 0.262 -0.159 -0.083
## .amphi_m_gr ~~
## .rotif_m_gr 0.188 0.113 1.662 0.096 0.188 0.123
## .pcope_gr -0.340 0.097 -3.489 0.000 -0.340 -0.265
## .mysid_gr 0.154 0.168 0.918 0.359 0.154 0.067
## .estfsh_bsmt_gr -0.204 0.148 -1.374 0.169 -0.204 -0.101
## .rotif_m_gr ~~
## .pcope_gr -0.344 0.182 -1.894 0.058 -0.344 -0.140
## .mysid_gr -1.034 0.330 -3.135 0.002 -1.034 -0.236
## .estfsh_bsmt_gr -0.279 0.283 -0.985 0.325 -0.279 -0.072
## .pcope_gr ~~
## .mysid_gr 0.905 0.277 3.268 0.001 0.905 0.247
## .estfsh_bsmt_gr 0.439 0.238 1.842 0.065 0.439 0.136
## .mysid_gr ~~
## .estfsh_bsmt_gr -0.060 0.421 -0.143 0.887 -0.060 -0.010
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.329 0.034 9.644 0.000 0.329 0.697
## .hcope_gr 0.737 0.076 9.644 0.000 0.737 0.643
## .amphi_m_gr 0.801 0.083 9.644 0.000 0.801 0.783
## .rotif_m_gr 2.933 0.304 9.644 0.000 2.933 0.568
## .pcope_gr 2.055 0.213 9.644 0.000 2.055 0.638
## .mysid_gr 6.540 0.678 9.644 0.000 6.540 0.575
## .estfsh_bsmt_gr 5.044 0.523 9.644 0.000 5.044 0.728
##
## R-Square:
## Estimate
## chla_gr 0.303
## hcope_gr 0.357
## amphi_m_gr 0.217
## rotif_m_gr 0.432
## pcope_gr 0.362
## mysid_gr 0.425
## estfsh_bsmt_gr 0.272
summary(modfitS, standardized=T, rsq=T)
## lavaan 0.6-10 ended normally after 41 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 81
##
## Used Total
## Number of observations 192 312
##
## Model Test User Model:
##
## Test statistic 24.127
## Degrees of freedom 24
## P-value (Chi-square) 0.454
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla_gr ~
## chla_1 -0.493 0.050 -9.865 0.000 -0.493 -0.607
## hcope_1 0.054 0.047 1.156 0.248 0.054 0.067
## clad_1 0.141 0.044 3.208 0.001 0.141 0.188
## rotif_m_1 -0.054 0.045 -1.195 0.232 -0.054 -0.068
## corbic_1 -0.011 0.045 -0.253 0.800 -0.011 -0.014
## flow -0.087 0.051 -1.702 0.089 -0.087 -0.105
## turbid -0.005 0.046 -0.116 0.908 -0.005 -0.007
## temp 0.022 0.045 0.487 0.626 0.022 0.029
## hcope_gr ~
## chla_1 0.148 0.058 2.538 0.011 0.148 0.158
## hcope_1 -0.457 0.057 -8.055 0.000 -0.457 -0.493
## pcope_1 0.009 0.054 0.171 0.864 0.009 0.010
## corbic_1 0.107 0.055 1.960 0.050 0.107 0.117
## flow -0.119 0.062 -1.923 0.055 -0.119 -0.125
## turbid -0.087 0.057 -1.519 0.129 -0.087 -0.098
## temp 0.059 0.057 1.034 0.301 0.059 0.066
## estfish_bsmt_1 -0.132 0.056 -2.372 0.018 -0.132 -0.149
## clad_gr ~
## chla_1 0.273 0.092 2.962 0.003 0.273 0.199
## clad_1 -0.604 0.085 -7.136 0.000 -0.604 -0.475
## pcope_1 0.034 0.084 0.408 0.683 0.034 0.026
## flow 0.238 0.092 2.587 0.010 0.238 0.171
## turbid -0.080 0.086 -0.926 0.355 -0.080 -0.061
## temp 0.033 0.086 0.383 0.701 0.033 0.025
## estfish_bsmt_1 -0.124 0.083 -1.491 0.136 -0.124 -0.095
## amphi_m_gr ~
## chla_1 -0.042 0.095 -0.440 0.660 -0.042 -0.025
## amphi_m_1 -0.885 0.089 -9.914 0.000 -0.885 -0.594
## flow -0.075 0.100 -0.751 0.453 -0.075 -0.045
## turbid 0.198 0.096 2.069 0.039 0.198 0.127
## temp 0.082 0.093 0.883 0.377 0.082 0.053
## estfish_bsmt_1 0.061 0.094 0.642 0.521 0.061 0.039
## rotif_m_gr ~
## chla_1 -0.064 0.101 -0.632 0.527 -0.064 -0.037
## rotif_m_1 -0.986 0.095 -10.400 0.000 -0.986 -0.579
## flow 0.367 0.104 3.524 0.000 0.367 0.209
## turbid -0.101 0.097 -1.033 0.302 -0.101 -0.061
## temp -0.032 0.097 -0.332 0.740 -0.032 -0.020
## estfish_bsmt_1 0.124 0.096 1.288 0.198 0.124 0.075
## pcope_gr ~
## chla_1 0.377 0.101 3.749 0.000 0.377 0.232
## hcope_1 -0.121 0.100 -1.208 0.227 -0.121 -0.075
## clad_1 0.102 0.096 1.057 0.291 0.102 0.068
## pcope_1 -0.762 0.097 -7.857 0.000 -0.762 -0.491
## corbic_1 0.046 0.094 0.488 0.625 0.046 0.029
## flow 0.003 0.106 0.031 0.975 0.003 0.002
## turbid -0.100 0.097 -1.027 0.305 -0.100 -0.064
## temp 0.001 0.096 0.013 0.990 0.001 0.001
## estfish_bsmt_1 -0.060 0.097 -0.616 0.538 -0.060 -0.039
## estfish_bsmt_gr ~
## estfish_bsmt_1 -1.451 0.174 -8.335 0.000 -1.451 -0.524
## hcope_1 -0.007 0.177 -0.039 0.969 -0.007 -0.002
## pcope_1 -0.207 0.173 -1.200 0.230 -0.207 -0.074
## amphi_m_1 0.242 0.159 1.519 0.129 0.242 0.091
## rotif_m_1 -0.035 0.168 -0.208 0.835 -0.035 -0.012
## clad_1 0.277 0.168 1.650 0.099 0.277 0.102
## flow -0.156 0.191 -0.818 0.413 -0.156 -0.053
## turbid 0.494 0.177 2.793 0.005 0.494 0.177
## temp -0.025 0.172 -0.146 0.884 -0.025 -0.009
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr ~~
## .hcope_gr 0.124 0.036 3.429 0.001 0.124 0.255
## .clad_gr 0.200 0.055 3.663 0.000 0.200 0.274
## .amphi_m_gr 0.018 0.058 0.315 0.752 0.018 0.023
## .rotif_m_gr 0.184 0.062 2.980 0.003 0.184 0.220
## .pcope_gr -0.006 0.059 -0.095 0.924 -0.006 -0.007
## .estfsh_bsmt_gr -0.082 0.106 -0.777 0.437 -0.082 -0.056
## .hcope_gr ~~
## .clad_gr 0.199 0.066 3.005 0.003 0.199 0.222
## .amphi_m_gr 0.104 0.071 1.455 0.146 0.104 0.106
## .rotif_m_gr -0.211 0.075 -2.804 0.005 -0.211 -0.207
## .pcope_gr 0.092 0.072 1.268 0.205 0.092 0.092
## .estfsh_bsmt_gr -0.302 0.131 -2.298 0.022 -0.302 -0.168
## .clad_gr ~~
## .amphi_m_gr 0.086 0.107 0.808 0.419 0.086 0.058
## .rotif_m_gr 0.219 0.113 1.946 0.052 0.219 0.142
## .pcope_gr 0.078 0.109 0.719 0.472 0.078 0.052
## .estfsh_bsmt_gr -0.217 0.196 -1.107 0.268 -0.217 -0.080
## .amphi_m_gr ~~
## .rotif_m_gr -0.077 0.122 -0.628 0.530 -0.077 -0.045
## .pcope_gr -0.154 0.119 -1.288 0.198 -0.154 -0.093
## .estfsh_bsmt_gr -0.659 0.219 -3.006 0.003 -0.659 -0.222
## .rotif_m_gr ~~
## .pcope_gr 0.295 0.126 2.342 0.019 0.295 0.171
## .estfsh_bsmt_gr 0.298 0.224 1.329 0.184 0.298 0.096
## .pcope_gr ~~
## .estfsh_bsmt_gr 0.738 0.224 3.295 0.001 0.738 0.245
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .chla_gr 0.394 0.040 9.798 0.000 0.394 0.653
## .hcope_gr 0.593 0.061 9.798 0.000 0.593 0.737
## .clad_gr 1.349 0.138 9.798 0.000 1.349 0.783
## .amphi_m_gr 1.621 0.165 9.798 0.000 1.621 0.658
## .rotif_m_gr 1.766 0.180 9.798 0.000 1.766 0.642
## .pcope_gr 1.676 0.171 9.798 0.000 1.676 0.694
## .estfsh_bsmt_gr 5.423 0.553 9.798 0.000 5.423 0.692
##
## R-Square:
## Estimate
## chla_gr 0.347
## hcope_gr 0.263
## clad_gr 0.217
## amphi_m_gr 0.342
## rotif_m_gr 0.358
## pcope_gr 0.306
## estfsh_bsmt_gr 0.308
#modificationindices(modfitW, sort=T, maximum.number=20)
#residuals(modfitW)
labelsfarwest=createLabels(modfitFW, cnameslag)
labelswest=createLabels(modfitW, cnameslag)
labelsnorth=createLabels(modfitN, cnameslag)
labelssouth=createLabels(modfitS, cnameslag)
#FAR WEST
zoop_plot_far_west <- createGraph(fit=modfitFW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="Far West",
title="Far West",
manual_port_settings=TRUE)
zoop_plot_far_west
#WEST
zoop_plot_west <- createGraph(fit=modfitW,
reference_df=cnameslag,
model_type="monthly_zoop",
region="West",
title="West",
manual_port_settings=TRUE)
zoop_plot_west
#NORTH
zoop_plot_north <- createGraph(fit=modfitN,
reference_df=cnameslag,
model_type="monthly_zoop",
region="North",
title="North",
manual_port_settings=TRUE)
zoop_plot_north
#SOUTH
zoop_plot_south <- createGraph(fit=modfitS,
reference_df=cnameslag,
model_type="monthly_zoop",
region="South",
title="South",
manual_port_settings=TRUE)
zoop_plot_south